• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

Detecting end of a batchfile in a doswindow and closing it

When I create a new process (which is a batch file running in a doswindow) with createprocess or shell the window will not close when the batchfile is done (I even tried to put exit as the last command in the batch file but it won't help). By the way how can you minimize the doswindow automatically with createprocess

Thanks in advance
0
lermytte
Asked:
lermytte
  • 2
1 Solution
 
nfernandCommented:
Hi... I've sufferd this for a month till I realize that the batch file MUST END in the windows directory.

Simply add these 2 lines at the end of your batch file:

c:
cd \windows

Hope this help.
0
 
nfernandCommented:
SORRY...  I read your words too quick. Mine is not help for you.
0
 
mark2150Commented:
Set the properties of COMMAND.COM to be Run Minimized and Close on Exit...

The command to invoke the batch file also needs the /C switch to let the OS know not to leave COMMAND.COM resident.

SHELL( "C:\COMMAND.COM /C MyBatch.BAT"), 1

I have code to the ExecCmd that will run and wait for completion on my web page: www.cyberchute.com/rvbus.

M
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now