Batch command to pause script until application is closed?

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.
4 answers Last reply
More about batch command pause script application closed
  1. Hi :)

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

    All the best Brett :)
  2. 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.
  3. 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.
  4. 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?
Ask a new question

Read More

Command Prompt Windows 7