开发者

Windows: wait for process to finish

开发者 https://www.devze.com 2023-03-12 08:42 出处:网络
I have to make a short Windows shell script. Please don\'t run away. It couldn\'t be simpler, but I j开发者_JAVA百科ust can\'t find the way to make this frankly primitive command-line to work with me.

I have to make a short Windows shell script. Please don't run away. It couldn't be simpler, but I j开发者_JAVA百科ust can't find the way to make this frankly primitive command-line to work with me.

I simply want to run dxdiag, and do something with the gathered data.

Thing is, I can't get the script to wait for dxdiag to finish, since it spawns the process and keeps on going. I need the file to exist and have the information before moving on to the next line.

Using start /wait has no effect, I'm guessing because there's no GUI involved.

I'm starting to think this isn't possible. Please help!


I tried something like this

start /wait dxdiag /x:SomeXmlFile

And it is working for me in Windows Vista.


Do something similar to THIS code:

tasklist /FI "IMAGENAME eq dxdiag.exe" 2>NUL | find /I /N "dxdiag.exe">NUL
if "%ERRORLEVEL%"=="0" goto next_area_here
  • if errorlevel is returned as 0, dxdiag in this case is CLOSED
  • if errorlevel returned as 1, dxdiag in this case is OPEN
0

精彩评论

暂无评论...
验证码 换一张
取 消