Tazx2x Posted March 2, 2018 Share Posted March 2, 2018 Hey Guys, I would like Autoit to simple type in : Msiexec /I Code42_client.msi CP_ARGS="DEPLOYMENT_URL=https://code42-auth.antas.com:4285&DEPLOYMENT_POLICY_TOKEN=9ef3e3a5-c58b-4300-9898-ebb99edc09a9" CP_SILENT=true /norestart /qn Into cmd but it gives me an error. Wheter I use SEND or ControlSend. An ideas Thanks you in advance! Link to comment Share on other sites More sharing options...
Earthshine Posted March 2, 2018 Share Posted March 2, 2018 use the Run command. Use the helpfile for examples. post what you are using here if you want help, even if the script does not work. msi are easy to install My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Developers Jos Posted March 2, 2018 Developers Share Posted March 2, 2018 6 minutes ago, Tazx2x said: Wheter I use SEND or ControlSend. An ideas Neither ... just use runwait... something like this: RunWait(@ComSpec & ' /c Msiexec /I Code42_client.msi CP_ARGS="DEPLOYMENT_URL=https://code42-auth.antas.com:4285&DEPLOYMENT_POLICY_TOKEN=9ef3e3a5-c58b-4300-9898-ebb99edc09a9" CP_SILENT=true /norestart /qn') Use /k in case it doesn't work so the cmd window stays open to see the error. Jos Earthshine 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tazx2x Posted March 2, 2018 Author Share Posted March 2, 2018 Here is my code. #RequireAdmin run ("cmd") WinWaitActive ("Administrator: C:\WINDOWS\SYSTEM32\CMD.exe") ControlSend ("Msiexec /I Code42_client.msi CP_ARGS="DEPLOYMENT_URL=https://code42-auth.antas.com:4285&DEPLOYMENT_POLICY_TOKEN=9ef3e3a5-c58b-4300-9898-ebb99edc09a9" CP_SILENT=true /norestart /qn") Send("{enter}") Not sure what im doing wrong Link to comment Share on other sites More sharing options...
Developers Jos Posted March 2, 2018 Developers Share Posted March 2, 2018 Just now, Tazx2x said: Not sure what im doing wrong Did you read the previous 2 posts? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Tazx2x Posted March 2, 2018 Author Share Posted March 2, 2018 Maybe im not following I dont wanna "Run" I just wanna type this "String" into cmd. Link to comment Share on other sites More sharing options...
Earthshine Posted March 2, 2018 Share Posted March 2, 2018 lol, jos gave you the answer. that is what you want to do actually. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Developers Jos Posted March 2, 2018 Developers Share Posted March 2, 2018 (edited) 18 minutes ago, Tazx2x said: Maybe im not following I dont wanna "Run" So what do you think you do when you Cut&Paste the command into the CMD window and send ENTER? .. but whatever... look at the helpfile for the proper syntax of controlSend() when you insist as the current use is invalid. Jos Edited March 2, 2018 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Bilgus Posted March 2, 2018 Share Posted March 2, 2018 While I would recommend what Jos suggested any day over this maybe you just don't have a way around it Const $_SEND_RAW = 1 $sYourCmd = 'Msiexec /I Code42_client.msi CP_ARGS=' & _ '"DEPLOYMENT_URL=https://code42-auth.antas.com:4285&DEPLOYMENT_POLICY_TOKEN=9ef3e3a5-c58b-4300-9898-ebb99edc09a9"' & _ 'CP_SILENT=true /norestart /qn' RunWait(@ComSpec & " /c " & $sYourCmd & " /k") ;OR $PID = run (@ComSpec) Sleep(1000) ;;NOTE: You need to get the handle from PID instead of just waiting ControlSend("[CLASS:ConsoleWindowClass]", "", "", $sYourCmd, $_SEND_RAW ) ControlSend("[CLASS:ConsoleWindowClass]", "", "", "{ENTER}") Its not guaranteed to be successful, AND you really should be getting the handle rather than just indiscriminately sending crap to any open console window AND its just bad juju Link to comment Share on other sites More sharing options...
Tazx2x Posted March 8, 2018 Author Share Posted March 8, 2018 Hey guys thanks for the assist! I think I know what the issue is. The script works on win7 but when I run cmd as an admin on win 10 this seems to be the issue. I need to figure that out. When I open cmd on 10 (reg user) everything works but I need it to work as admin! Link to comment Share on other sites More sharing options...
Tazx2x Posted March 8, 2018 Author Share Posted March 8, 2018 Hello Everyone, I seem to have run into an issue with Windows 10. When running (See Below) on windows 10 it prompt for user opens cmd as admin and does nothing. If I run the same code without (#RequireAdmin) everything works. I never had these issue with Windows 7 is there something I am missing. Thank you in advance! #RequireAdmin run ("cmd") WinWaitActive ("Administrator: C:\WINDOWS\SYSTEM32\CMD.exe") ControlSend ("Test") Send("{enter}") Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 9, 2018 Moderators Share Posted March 9, 2018 First off, I can't see this working at all, as ControlSend has more than a single required parameter. Apart from that, whether in Windows 7 or Windows 10, the only way it isn't going to prompt when using #RequireAdmin is if UAC is disabled, or if you start AutoIt as an Administrator. "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...
Moderators JLogan3o13 Posted March 9, 2018 Moderators Share Posted March 9, 2018 (edited) @Tazx2x It is not two issues, in fact, threads merged. I answered above why you're likely having problems with the command (before I saw this was your second thread on the same subject). More importantly, as Jos has tried to point out to you - why go through the headache of mixing languages in your script? You're trying to get an AutoIt script to open a CMD window for you, type text into it, and then run the MSI job. Why not save yourself the headache and simply install the MSI straight from AutoIt, and skip the cmd line middle man? AutoIt can do anything you can do in a cmd line window, and more. This works for me (version 6.5), /qb so you can see the install: #RequireAdmin ShellExecute('msiexec.exe', '/i Code42_Client.msi CP_ARGS="DEPLOYMENT_URL=https://code42-auth.antas.com:4285&DEPLOYMENT_POLICY_TOKEN=9ef3e3a5-c58b-4300-9898-ebb99edc09a9" CP_SILENT=true /norestart /qb') Edited March 9, 2018 by JLogan3o13 "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...
Tazx2x Posted March 9, 2018 Author Share Posted March 9, 2018 @JLogan3o13 I apologize if I broke any rules opening another post. I figured they were 2 separate issue. I fixed the MSI issue but im not following on why I can send commands to cmd after opening as admin. I lookied at the help file but it doesnt seem to clarify my issues. 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