Sign in to follow this  
Followers 0
venki284

Script to run cmd in system context to install exe's

8 posts in this topic

Hi

I am trying to open cmd in system context using psexec.exe from the below vbscipt, I am successful. Looking to create au3 file for the same functionality

path="C:\Packs\Completed_Pkg\Setup\"

objShell.run "C:\Tools\temp\PsExec.exe -i -s cmd /c "& chr(34)&path&"Setup.exe"&chr(34)&" /Popup"

AU3File

----------

run("C:\Tools\temp\PsExec.exe -i -s cmd") unable to run this in autoit. Here it opens the cmd and closes immediately

But if i use run("C:\Tools\temp\PsExec.exe cmd") the script works and opens user context and for system context I need to pass "-i -s" for the psexec.exe.

Please help me how I can do this??Thanks in advance.

Share this post


Link to post
Share on other sites



Hi ,

in Autoit is better to use

ShellExecute("PsExec.exe","-i -s cmd /c","C:Toolstemp",@SW_MAXIMIZE)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Sikkin,

Thanks for your reply,

But after running I got this error

"The file does not have a program associated with it for performing this action. Please install a program and if one already installed,create an association in the default programs control panel". The psexec.exe file is a standalone exe.

Thanks,

Venkat.

Edited by venki284

Share this post


Link to post
Share on other sites

Try it like this:

ShellExecute("C:ToolstempPsExec.exe -i -s cmd /c "& chr(34)&path&"Setup.exe"&chr(34)&" /Popup")

Share this post


Link to post
Share on other sites

Hi Juviji,

It doesnt work either there's some syntax error while executing.Any other help..?

Thanks,

Venkat.

Share this post


Link to post
Share on other sites

This runs a Setup.exe file as System for me:

$path="C:PacksCompleted_PkgSetup"
ShellExecute("PsExec.exe", '-i -s cmd /c "' & $path & 'Setup.exe" /Popup') ;PSExec in same dir as script.

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Hi Juviji,

It doesnt work either there's some syntax error while executing.Any other help..?

Thanks,

Venkat.

Did you compensate for the variables ? - chr(34)&path ? - Should be $chr(34)&$path and should be existing.

Share this post


Link to post
Share on other sites

Finally it worked for me!!! Hurray

Juviji is correct but the exe I should run as admin :guitar:

ShellExecuteWait("PsExec.exe"," -i -s cmd /c "& chr(34)&$path&"Setup.exe"&chr(34)&" /Popup","C:Toolstemp")

Thanks for all who helped me done this..I am posting another one soon wish you all give me same support.

Thanks,

Venkat.

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