Page 4 of 4
Re: Is there a command to close a running program
Posted: 22 May 2011 19:37
by Huidong
@serendipity
I tried the above without wait(1000), the first command successfully terminated defraggler (GUI) while the current tab was in sandbox, but then the second command did not start at all, until I added wait in between! So there's the tradeoff between run's wait option, and open's independency of the current path! What do you think?
Re: Is there a command to close a running program
Posted: 22 May 2011 19:50
by serendipity
Huidong wrote:@serendipity
I tried the above without wait(1000), the first command successfully terminated defraggler (GUI) while the current tab was in sandbox, but then the second command did not start at all, until I added wait in between! So there's the tradeoff between run's wait option, and open's independency of the current path! What do you think?
Yes, that's the tradeoff. That's why I suggested wait here.
And you can shorten the first line to:
open """%ComSpec%"" /c tskill Defraggler";
Re: Is there a command to close a running program
Posted: 22 May 2011 19:54
by Huidong
Rocks! For reference, I just went to
http://en.wikipedia.org/wiki/ComSpec
Thanks!
Re: Is there a command to close a running program
Posted: 22 May 2011 19:57
by serendipity
Also look at Help>Environmental variables
Re: Is there a command to close a running program
Posted: 22 May 2011 20:12
by Huidong
Oh good reminder!
And here's an immediate benefit using open and %comspec%.
Compare
Code: Select all
"Run Registry Workshop as SYSTEM"
open '"%comspec%" /c psexec -s -i "C:\Program Files\Registry Workshop\RegWorkshop.exe"';
with the orignial
Code: Select all
"Run Registry Workshop as SYSTEM"
goto "%computer%", 1;
run "cmd /c cd /d C:\Windows\System32\ & PsExec -s -i ""C:\Program Files\Registry Workshop\RegWorkshop.exe""";
#520; //Go back
Both avoided being trapped in sandbox but the second is ugly.
Happy.