MrBeatnik Posted October 5, 2006 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.
this-is-me Posted October 5, 2006 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?
MrBeatnik Posted October 6, 2006 Author 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.
daslick Posted October 9, 2006 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
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