Sign in with
Sign up | Sign in
Your question

Batch command to pause script until application is closed?

Last response: in Windows 7
Share
September 12, 2012 9:56:50 PM

It's probably something obvious but both PAUSE and WAITFOR don't seem have the functionality I needed. The batch file (windows command script) I'm making is intended to do something fairly simple. It extracts a 7zip file into the TEMP directory then starts an executable from that 7zip file. All that is not a problem, but I really wanted to add some house cleaning functionality as well. Namely, after that executable or process is closed, the script deletes the extracted content from the TEMP folder.

Also, but less importantly I was wondering if there is a way to hide the command prompt while the script & application is running, mainly so the command prompt window isn't closed while waiting for the application to end, thus missing the command to purge the TEMP files.

Thanks in advance.
a b $ Windows 7
September 12, 2012 10:07:56 PM

Hi :) 

Umm , i think you had better explain WHY you want to hide this from the user.... :( 

All the best Brett :) 
m
0
l
September 12, 2012 10:14:46 PM

It isn't really intended to hide anything, this is for a flash drive with freeware utilities I'm trying to customize, deleting the files from the temp folder is actually to help me determine the functionality of a new script I make or edit. The idea is that with each run, I want the application and any other files removed so when I test an edit, I don't have to manually go in and remove them from temp to make sure the old script run isn't effecting the results of the edited or new version.

It was something I was previously doing manually, deleting the extracted files, editing the script, testing it again. This is more to help me automate the process a bit.
m
0
l
Anonymous
a b $ Windows 7
September 12, 2012 10:15:41 PM

Brett928S2 said:
Hi :) 

Umm , i think you had better explain WHY you want to hide this from the user.... :( 

All the best Brett :) 


He did, so the command window is not inadvertently closed before the extracted application has finished.
m
0
l
September 12, 2012 11:33:39 PM

I did some digging and apparently the command is:

@start '''' /wait "application.exe"

I knew it had to be something simple, now I just have to find out how to hide the empty command prompt window that hangs around while waiting for the application to end. Anyone have any ideas?
m
0
l
!