|
Answer» Hi.
Everytime on my XP computer when i try run a batch file, the window closes strait after it is open and it works fine on my windows 2000 comp, and when i go to the properties of a batch file i dont see all the options as i do on my 2000 computer like: General, Program, Font etc. Does anyone know how to stop the batch command windows from closing or know how i dont get the same properties as on my other computer??Is this happening before you run the batch file or after?
I couldn't find an option on the CMD property sheets to control this , so the next suspect would be the batch file itself. Check thru it and ensure there are no EXIT statements. Exit statements will force the window to close.
Hope this helps. It happends after i run the batch, it OPENS for about half a sec then closes and it was working good,normal a few days ago. It happens with any command, like i will type in this and it will still close:
@if exist c:\*.* echo bob or even just echo sausage.
I tried sending a batch file from my other computer to this one because they dont close on the other one and it still closes, the ms-dos command prompt is still working fine.This must be a XP "feature" I get the same results whether I use a shortcut or double click the actual file. Two workarounds (geez I hate that word): PUT a PAUSE statement at the end of the file or open a CMD window and run the file from the prompt.
Hope this helps. I saw in the properties the you can choose which compatibibity you can run it with and i tried them all and it didnt work, i still dont know the problem but it doesnt matter now because running from cmd works and the pause is good.
thx http://www.robvanderwoude.com/index.htmlI create batch file sin XP all the time to, if you open it from a DOS Prompt it will work find.
But just opening the batch script from your desktop or W/E it will just close, thats just how XP is.. yeah I know it suk, but I might be wrong , there might jusyt be a way to get it to stay up..use pause in your batch file that should do it. 1. Use a poors man's timer to hold the window open for a specified amount of time.
echo Window will close in 10 seconds ping 1.1.1.1 -n 10 -w 1000 >%TMP%null where 1.1.1.1 is a non-existant IP; -n 10 is the number of pings; 1000 is the time (in ms) between pings.
2. Copy choice.com from a Win9x CD and use a choice command to do the same thing.
echo Window will close in 10 seconds TYPE NUL | CHOICE.COM /N /CY /TY,10 >NUL
3. Copy an existing .pif file from a Win9x machine, place it on the desktop, and modify it to point to the correct program location. You can use this .pif to get the same parameters as those in 9x. It should work perfectly under command.com
|