MODIFICATION - You may encounter problems with the file being deleted before the script actually gets to run it. You should use the following code instead.
Set fileSys = CreateObject("Scripting.FileSystemObject"
Set fileOut = fileSys.CreateTextFile("D:\dotime.bat", True)
fileOut.WriteLine "time %1"
fileOut.Close
Set fil = fileSys.GetFile("D:\dotime.bat"
fil.Delete
Set fileOut = Nothing
Set wShell = Nothing
Set fil = Nothing
Set fileSys = Nothing
This changes the line:
wshell.Run run_this
to
wShell.Run run_this, 1, TRUE
Which causes the script to wait until completion of the "run_this" command to proceed with processing the script.
The previous code works perfectly for me, maybe because of how I have my System set up, I don't even see a dos window appear. If my post was helpful, please Mark it below. Thanks! - Al
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.