Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

closing batch file

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
If I write a batch file in Notepad with the last line
'CLS'
and run it from the windows run dialog,
Then it will close its window after it has terminated.

If I produce an identical batch file by saving to file from a Delphi program then it wont close its window!

does anyone know how to produce a batchfile *.bat that closes on exit from a delphi program?

Steve.
 
Hi Mike

Only tried it with 98SE so far.

Steve..


 
Are you saying that if you run this batchfile produced by the delphi program it won't close? Is there an extra new line in the Delphi-produced version that Win98 doesn't like or something?
What if you include 'Exit' as the last command of the file?
 
Maybe there is something hidden that stops it from working, There is certainly a small difference in the file size but none in the file parameters.

It's the same if I save from a stringlist/memo or use file variables. to create the file.
I will try putting EXIT at the end and see what happens

Steve.
 
I would guess that there ISN'T a newline char after the "CLS" and that the last line of the BAT file doesn't execute.
 
I have discoverd that if I save the contents of a memo to file then it works OK (not as I said previously).
Using memos to create very small files is a bit of a waste but gets around the problem, but I will try adding a newline to the text as you suggest thanks wgcs.

Steve
 
Just cls will close the file.
cls followed by a carriage return and/or line feed will leave the window open
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top