Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Bash / Shell Scripting (http://www.programmingforums.org/forum26.html)
-   -   Batch Programming (http://www.programmingforums.org/showthread.php?t=87)

Scunner Jun 29th, 2004 1:16 PM

What do you type in the code of a batch file so that it doesn't automatically close the dos prompt once it has completed the command?

I have setup a batch file that scans files in games as a sort of anti cheat patch. It compares differences between proper files and existing ones, I just want it to display or log the results instead of closing.

If I cant stop it closing how could I make it copy the results into a textfile or log?

Cheers

Scunner

big_k105 Jun 29th, 2004 2:36 PM

the only way i could think of doing this would be to either pause the program and have it wait for you to hit enter or for you to run the script while in the command promt instead of double clicking it. im not sure what you would use to make the promt not disappear besides doin this but maybe someone else will know :)

you could have it return all the info it finds into a file by using the >> operator i believe i would give it a try and see what happens :)

Infinite Recursion Jul 15th, 2004 3:25 PM

running the batch file using CMD /K your.bat will have the DOS window remain open after the batch is complete

IR

erebus Sep 15th, 2004 12:49 AM

If you don't have cmd available to you(9x/ME) or want to make your batch code portable, use the pause command in the script. Something like:
:

echo Hello, FreeBSD!
pause


Infinite Recursion Sep 15th, 2004 8:53 AM

wow.. this is 2 months old and comes back to life :)

If you were to use a 'pause', you will not be able to continue executing, unless you un-pause. You could always redirect your scripts variables to a text file via pipes.

erebus Sep 15th, 2004 8:31 PM

Just an alternative one could use.. not really the best method around, as you've depicted. I haven't worked with batch in quite some time, but I do remember that cmd was not available in DOS 5.0 :-P.

Infinite Recursion Sep 15th, 2004 9:42 PM

i think cmd came along within a windows-subset or something... the normal console would have appeared via 'command'.

erebus Sep 16th, 2004 11:25 PM

Indeed, command.com was the interpreter then, though I do believe it is still accesible in NT-centric Windows OSs. I wouldn't recommend using it unless your school has restricted cmd.exe, but that's another story :-P. The cool thing about command.com is that you can integrate your own commands or command versions, as apposed to cmd having all of the utilities embedded into it.

Infinite Recursion Sep 17th, 2004 8:58 AM

Yup. What is also cool, at least during my years of high school... was the fact you could rename the windows help option in the start menu to command.com and get DOS shell access despite security programs ;)

Berto Sep 17th, 2004 6:23 PM

:) or hacking the registry with it lockout was fun.

Had a lot of people coming up t me and saying ooo how you do that.


All times are GMT -5. The time now is 4:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC