MrBeatnik Posted October 5, 2006 Share Posted October 5, 2006 Hi all, Hope ya have some advice The following code works as you would expect; DOS box opens, waits 2 secs, then closes. $runPID=Run(@SystemDir & "\" & "cmd.exe",@SystemDir) Sleep(2000) ProcessClose($runPID) However, if I open the DOS box as another user, I cannot close the box at all, as so: RunAsSet("Administrator","domain-name","password") $runPID=Run(@SystemDir & "\" & "cmd.exe",@SystemDir) Sleep(2000) ProcessClose($runPID) RunAsSet() Can anyone give any suggestions for process killing as another user? Thanks! Please correct me if I am wrong in any of my posts. I like learning from my mistakes too. Link to comment Share on other sites More sharing options...
this-is-me Posted October 5, 2006 Share Posted October 5, 2006 This is because the user account you are logged into does not have this privilege. You can run the following command: RunAsSet("Administrator","domain-name","password") RunWait(@AutoItExe & ' /AutoIt3ExecuteLine "ProcessClose(' & $runPID & ')"') Who else would I be? Link to comment Share on other sites More sharing options...
MrBeatnik Posted October 6, 2006 Author Share Posted October 6, 2006 Yep, I knew the user doesn't have the rights, hence getting the processclose to "runas". This works a treat, I always forget about the AutoIt script lines. Thanks! Please correct me if I am wrong in any of my posts. I like learning from my mistakes too. Link to comment Share on other sites More sharing options...
daslick Posted October 9, 2006 Share Posted October 9, 2006 (edited) Pfff.. have been trying for like an hour now... but create a shortcut to tskill (located in system32) with the arguments cmd then run your shortcut and delete it. I couldn't get runwait(@comspec & " /c" & "tskill cmd", "", @SW_HIDE) to work... Good luck. EDIT - I completely forgot Processclose .... why do I always try things the hard way? DOE! Edited October 9, 2006 by daslick Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now