- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Oh more classics.
At least this one is a good one.
Not as good as "no quack"but still good.
Admin
To answer the question posed in the HTML comments. the 50quid was for the Vodka....everything else came for free.
Admin
If the OS detected this, it should raise a YourDoingItWrong error.
Admin
CP/M's batch file facility used to work somewhat similarly.
Whenever the CCP (Console Command Processor, analogous to command.com in a DOS system) loaded, it would check drive A: for a file called $$$.sub. If found, it would read the last 128-byte record (a whole disk sector; CP/M files were always multiples of 128 bytes) into the command line buffer, then truncate A:$$$.sub to remove that record, then process the command exactly as if it had just been typed at the terminal.
To run a batch file you'd use the supplied SUBMIT command, which would read in your batch file a line at a time, expand parameters, pad the resulting lines to 128 bytes, and write them out in reverse order to $$$.sub.
Windows doesn't have a separate SUBMIT command. Instead, its command processor reads batch files directly and does parameter expansion and execution on the fly. But even in 2014, cmd.exe does still do an open, read, close sequence for every single line of a .cmd script.
For scripts read from network shares, like logon or shutdown scripts, this is ridiculously slow. If your logon script is more than a very few lines long, you can easily get a 10x speedup by making it copy itself to %tmp% and re-run from there before doing anything else.
Admin
My guess is a self-modifying code on the fly like in example link And of course they haven't bothered to create something faster, since they will need to check after every line if the file is not modified by itself or something else, they could of course lock the file against writing to it but who wants that. But yes unless there is some caching issue with only reading file and getting old version in memory open and close are bit redundant.
example: http://stackoverflow.com/questions/906586/changing-a-batch-file-when-its-running
ye olden times reason: http://en.wikipedia.org/wiki/Self-modifying_code#Compound_Modification
trwtf is discourse (only 2 links for new user, and there are only two links(no of links allowed=0), yet it does not allow posting)
[edit: linkified - boomzilla]
Admin
Well, vbscript. And you can probably do powershell login scripts
Admin
you'll fit in well here i see.
;-)
Admin
Can
Admin
Can one
Admin
Can one really
Admin
Can one really call
Admin
Can one really call an
Admin
Can one really call an article
Admin
Can one really call an article "popular"
Admin
Can one really call an article "popular" if
Admin
Can one really call an article "popular" if it
Admin
Can one really call an article "popular" if it received
Admin
Can one really call an article "popular" if it received only
Admin
You skipped a step.