Sign in to follow this  
Followers 0
MrBeatnik

ProcessClose() Woes

4 posts in this topic

Hi all,

Hope ya have some advice :lmao:

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.

Share this post


Link to post
Share on other sites



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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by daslick

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0