venki284 Posted July 31, 2012 Share Posted July 31, 2012 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. Link to comment Share on other sites More sharing options...
sikkin Posted July 31, 2012 Share Posted July 31, 2012 Hi , in Autoit is better to useShellExecute("PsExec.exe","-i -s cmd /c","C:Toolstemp",@SW_MAXIMIZE) Link to comment Share on other sites More sharing options...
venki284 Posted July 31, 2012 Author Share Posted July 31, 2012 (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 July 31, 2012 by venki284 Link to comment Share on other sites More sharing options...
Juvigy Posted July 31, 2012 Share Posted July 31, 2012 Try it like this: ShellExecute("C:ToolstempPsExec.exe -i -s cmd /c "& chr(34)&path&"Setup.exe"&chr(34)&" /Popup") Link to comment Share on other sites More sharing options...
venki284 Posted July 31, 2012 Author Share Posted July 31, 2012 Hi Juviji, It doesnt work either there's some syntax error while executing.Any other help..? Thanks, Venkat. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 31, 2012 Moderators Share Posted July 31, 2012 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. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Juvigy Posted August 1, 2012 Share Posted August 1, 2012 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. Link to comment Share on other sites More sharing options...
venki284 Posted August 1, 2012 Author Share Posted August 1, 2012 Finally it worked for me!!! Hurray Juviji is correct but the exe I should run as admin 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. 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