windows - How Can I Write a Batch File Where I Start one Program and When that Program Finishes or Closes, Start Another -
windows - How Can I Write a Batch File Where I Start one Program and When that Program Finishes or Closes, Start Another -
for example:
@echo off start c:\windows\system32\dfrgui.exe /c
wait defragmentation finish.
start c:\"program files (x86)"\ccleaner\ccleaner.exe /auto
wait ccleaner finish.
start c:\windows\system32\cleanmgr.exe /sagerun:1
and on.. point. how can this? thanks.
start can take command line argument /wait e.g.
@echo off title test cmd start start /wait wait.cmd 5 start /wait cmd /k echo launched sec command pause
this simple illustration uses script have written (wait.cmd shown below) first command executed, see if test /wait alternative specified script allows first command finish before continuing:
@echo off rem phone call # of seconds wait set /a secs=%1 set /a ms=%secs%*1000 echo process wait %secs% seconds , continue... ping 1.1.1.1 -n 1 -w %ms% > nul echo. exit
as side note if open cmd session can find out arguments command such start accepts e.g.
update next comment
so adapt commands listed in question finish before starting next command in script use:
@echo off start /wait c:\windows\system32\dfrgui.exe /c start /wait c:\"program files (x86)"\ccleaner\ccleaner.exe /auto start /wait c:\windows\system32\cleanmgr.exe /sagerun:1
windows batch-file command-line windows-7
Comments
Post a Comment