Page 2 of 4
Re: Is there a command to close a running program
Posted: 21 May 2011 09:23
by serendipity
Huidong wrote:TSKILL defraggler in cmd worked!
But again,
run "cmd /c TSKILL defraggler"
does not work!
where are you trying that command from?
address bar?
PS: are you using :: in front of run?
Re: Is there a command to close a running program
Posted: 21 May 2011 09:36
by Huidong
Things go weird. I run the command from Scripting - Run Script... on the menu.
I rebooted by machine and once again I can kill notepad with that command. then I run the following:
Code: Select all
"Defrag selected (Recursive)"
run "cmd /c tskill defraggler";
open '"D:\Portable\Defraggler\df.exe" <selitems> /S';
Defraggler did not get killed, and df.exe wasn't run either; then I tried the same command to kill notepad, this time, it failed!
Then I rebooted my machine again, and tried to kill notepad, still it failed!
Any clue?
Re: Is there a command to close a running program
Posted: 21 May 2011 09:40
by Huidong
Also later I changed the line to
Code: Select all
run "cmd /c tskill defraggler", , 1;
But at that time I can't even kill notepad!
Re: Is there a command to close a running program
Posted: 21 May 2011 09:45
by serendipity
Huidong wrote:Things go weird. I run the command from Scripting - Run Script... on the menu.
I rebooted by machine and once again I can kill notepad with that command. then I run the following:
Code: Select all
"Defrag selected (Recursive)"
run "cmd /c tskill defraggler";
open '"D:\Portable\Defraggler\df.exe" <selitems> /S';
Defraggler did not get killed, and df.exe wasn't run either; then I tried the same command to kill notepad, this time, it failed!
Then I rebooted my machine again, and tried to kill notepad, still it failed!
Any clue?
Sorry, no idea. Except make sure that before "run" and "open" you have atleast one space.
Re: Is there a command to close a running program
Posted: 21 May 2011 09:48
by Huidong
Yes I have two spaces. I mean this is not a particular problem for defraggler, it's all about running cmd /c tskill thru XY, It worked twice, for both notepad and defraggler! Then the same command stops working! But running cmd.exe alone always work. I guess that's the problem of XY?
Re: Is there a command to close a running program
Posted: 21 May 2011 09:53
by nas8e9
Huidong wrote:TSKILL defraggler in cmd worked!
But again,
run "cmd /c TSKILL defraggler"
does not work!
I can't get it to work either; Sysinternals pskill (as described above) however does work for me on Windows 7 x64 SP1.
Re: Is there a command to close a running program
Posted: 21 May 2011 10:02
by Huidong
Could you show me how to use pskill, please?
Re: Is there a command to close a running program
Posted: 21 May 2011 10:11
by Huidong
I tried
in XY, didn't work, but in cmd.exe, it worked. I put pskill in system32.
What's wrong here?
Re: Is there a command to close a running program
Posted: 21 May 2011 10:13
by serendipity
Huidong wrote:Yes I have two spaces. I mean this is not a particular problem for defraggler, it's all about running cmd /c tskill thru XY, It worked twice, for both notepad and defraggler! Then the same command stops working! But running cmd.exe alone always work. I guess that's the problem of XY?
Should have asked earlier, how about:
run (TSKILL defraggler);
Re: Is there a command to close a running program
Posted: 21 May 2011 10:24
by Huidong
Holy sh*t!!! I finally figured out what was the problem!!! Not about using either cmd or pskill, the nasty, mysterious "bug" is that when the current tab is a folder in a sandbox (using Sandboxie), then neither run "cmd ..." nor run "pskill" works, however, when the current tab is not in a sandboxed folder, as far as I know, any place except in the sandbox, both cmd and pskill work!!! This is mysterious, since I thought running a command from Scripting - Run Script... should not have anything to do with the current tab location! Any clue what's going on?? Ghost!
Re: Is there a command to close a running program
Posted: 21 May 2011 10:30
by serendipity
Huidong wrote:Holy sh*t!!! I finally figured out what was the problem!!! Not about using either cmd or pskill, the nasty, mysterious "bug" is that when the current tab is a folder in a sandbox (using Sandboxie), then neither run "cmd ..." nor run "pskill" works, however, when the current tab is not in a sandboxed folder, as far as I know, any place except in the sandbox, both cmd and pskill work!!! This is mysterious, since I thought running a command from Scripting - Run Script... should not have anything to do with the current tab location! Any clue what's going on?? Ghost!
OK so that's the culprit. when you run:
::run "cmd /c TSKILL defraggler"
it first starts cmd in that folder. you will see if you run cmd with /k instead of /c :
run "cmd /k TSKILL defraggler"
what happens with this?
run "cmd /K cd /d c:\ & TSKILL defraggler";
this will first go to c:\ and then execute the task kill.
Re: Is there a command to close a running program
Posted: 21 May 2011 10:59
by Huidong
Really good news!
run "cmd /K cd /d c:\ & TSKILL defraggler";
did not work, but I did use your command to do sth very handy:
Code: Select all
"Run regedit as SYSTEM"
run "cmd /k cd /d C:\Windows\System32\ & PsExec -s -i regedit"
Back to the issue, when I run tskill when the current tab is in sandbox, the cmd did open in C:\, but it reports that end process failed because access is denied. Moreover, even when the current tab is out of sandbox, in which case tskill can kill defraggler, but the cmd window remains open so the next command (calling df.exe) can not start. This did not happen using /c.
But thanks very much, learning a lot of things.
Re: Is there a command to close a running program
Posted: 21 May 2011 11:04
by Huidong
Can you explain what /d is for? THanks
Re: Is there a command to close a running program
Posted: 21 May 2011 11:15
by nas8e9
Huidong wrote:Can you explain what /d is for? THanks
It's a parameter of the cd (change directory) command that makes cd traverse drive boundaries; without it
while the current location is on D:, wouldn't change to C:; when entering just C: however, you would be in \windows\system32. The /d parameter changes the current location as well, i.e. if the current location is on D: you'd end up in C:\Windows\System32 without first having to enter just C:.
Re: Is there a command to close a running program
Posted: 21 May 2011 11:17
by PeterH
I don't understand exactly what you mean with "current tab is in sandbox"
But as I understand the function of a sandbox, then it's to disallow changes from inside to the outside - especially killing tasks outside of the sandbox? That is: keep system safe, whatever program in sandbox tries to do...