Jump to content
Sign in to follow this  

Detecting the close of a DOS Window

Recommended Posts

I'm trying to get one DOS run command to "run" after the first closes. The time that #1 will remain open will be variable because of the quantity of documents each user has. When I run the program compiled, #2 must be executing before #1 finishes as I do not get the output file. When run separately, manually, it works fine.

1. Run(@Comspec & ' /c cipher.exe /e /a /s:"' & "C:\Documents and Settings\" & @UserName & "\My Documents" & '"')

After the above line executes, fully, and the DOS window closes I need to continue in my program by running:

2. Run(@Comspec & ' /c cipher /x c:\' & @UserName & "_" &@ComputerName & '.pfx', 'c:\')

The problem seems to be that 2 starts executing either immediately or too soon. I've added

Sleep(500) ;500 milliseconds and between the two and that has not helped.

Is there any way to detect when #1 closes so I can then execute #2?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...