Strange....

Conradl

Expert Member
Joined
Dec 10, 2008
Messages
2,629
Reaction score
1
Location
Joburg
Create a batch file called logoff.bat (name must be logoff.bat). In the batch file type "start logoff". Run it (Save your work, not because it will log you off though....). Don't understand why it does what it does??? :confused::confused::confused::confused:
 
Sorry man :) Was in a rush and got as far as advising to save your work! But it is weird huh? If you type logoff from a command prompt, it just logs you off. If you change the batch name it also works??
 
it is an old dos thing.

if you have a directory, with files all called executable.*

i.e.
executable.bat
executable.com
executable.exe
(pay no attention to the order here, t was jsut the order i typed them in..)


and you are in that directory, the hierachy is .bat, .com, .exe, with current directory taking precedence over the path= statement

logoff.bat in current directory will be run before logoff.bat in path....etc...


so typing
c:\executable
will run the bat file


logoff is an exe, so will be lowest in the pecking order


linux works almost exactly opposite

so your original logoff.bat runs like this
run logoff.bat, which tells it to run logoff.bat which tells it to run logoff.bat etc
 
Last edited:
Sorry man :) Was in a rush and got as far as advising to save your work! But it is weird huh? If you type logoff from a command prompt, it just logs you off. If you change the batch name it also works??

I expected that my systems logs off, and then all those nice little black windows fly in :D Still donr get it why it does it like 130-150 times and then just stops. Shouldnt it go one forever untill your pc rund out of memory and freezes(werners theory).
 
Last edited:
Its stops because your system runs of memory :) Mine gets to 600 and then tanks.... What Werner says makes sense. Was surprised today when I saw it though, because I have been writing scripts for 10+ years and have never experienced it, although I use KIX mostly.....

Each CMD takes around 1-2 MB
 
not really a theory, this is how dos works, and command line is still leftover from dos with those old rules in place.

if you changed the batch file logoff.bat to read

start logoff.exe

then it would work as expected
 
actually, just a correction to my first post, the hierachy is

.com
.exe
.bat

with folder precedence over path statement
so .bat in current folder you are in takes precedence over .exe in path
 
Intead of putting "start logoff" in the batch file, try typing it twice. It grows to become an unstoppable monster!

start logoff
start logoff
 
not really a theory, this is how dos works, and command line is still leftover from dos with those old rules in place.

if you changed the batch file logoff.bat to read

start logoff.exe

then it would work as expected

Ah, that makes sense! With something like Kix you would have to specify the extension, or else it won't run! With Windows batch you get lazy and cause problems for yourself....
 
Top
Sign up to the MyBroadband newsletter
X