LisHawj Posted April 11, 2018 Share Posted April 11, 2018 Hi everyone, I did search on the forum and found much useful information on how to run WMIC.exe with Auotit, but I am still unable to get my script working. I simply need to grab the file or product version of Enase (Enstart64.exe), and I have tried it every way I was shown in articles/posts on I have found on the topic. Still no go. Can someone take a glance and tell me what the heck I am doing wrong with this command? Thank you. Running this from Windows CMD works: wmic.exe datafile where name='C:\\Windows\System32\\Enstart64.exe' GET version $var1 = "C:\Windows\System32\Enstart64.exe" $var2 = "GET version" $var3 = "datafile where name='" $iVer =ShellExecuteWait("wmic.exe", $var3, $var1 & $var2) MsgBox(0,"", $iVer) $iVer =RunWait(@ComSpec & " /c " & "wmic.exe " & $var3 & $var1 & $var2, @SystemDir, @SW_SHOW) MsgBox(0,"", $iVer) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 11, 2018 Moderators Share Posted April 11, 2018 A couple of things: "Still no go" - doesn't help us a lot. Are you getting an error, or is nothing returned, etc. If you take your ShellExecuteWait command and output it to the console, does it look like what you would expect? If you change the /c to /k in your RunWait command to keep the command line window open, do you get any error or useful output? Please help us help you "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...
Developers Jos Posted April 11, 2018 Developers Share Posted April 11, 2018 29 minutes ago, LisHawj said: $iVer =ShellExecuteWait("wmic.exe", $var3, $var1 & $var2) There is a space missing between $var1 & $var2? 30 minutes ago, LisHawj said: $iVer =RunWait(@ComSpec & " /c " & "wmic.exe " & $var3 & $var1 & $var2, @SystemDir, @SW_SHOW) ... and here between all $var?s ? 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...
ripdad Posted April 11, 2018 Share Posted April 11, 2018 And ... double slashes with double quotes -- closed with single quotes. $var1 = '"C:\\Windows\\System32\\Enstart64.exe"' "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
LisHawj Posted April 11, 2018 Author Share Posted April 11, 2018 (edited) $var1 = "C:\\Windows\\System32\\Enstart64.exe" $var2 = " GET version" $var3 = " datafile where name='" $iVer =ShellExecuteWait("wmic.exe", $var3 & $var1 & $var2, @SW_SHOW) MsgBox(0,"", $iVer) $iVer =RunWait(@ComSpec & " /k " & "wmic.exe" & $var3 & $var1 & $var2, @SystemDir, @SW_SHOW) MsgBox(0,"", $iVer) Ok, so I'm still having trouble after reviewing all the comments and ensuring the "spacing" is all there. The program is reporting the following error. ERROR: Description = Invalid Query Edited April 11, 2018 by LisHawj Link to comment Share on other sites More sharing options...
ripdad Posted April 11, 2018 Share Posted April 11, 2018 $var1 = '"C:\\Windows\\System32\\Enstart64.exe"' $var2 = ' GET version' $var3 = ' datafile where name=' RunWait(@ComSpec & ' /k wmic.exe' & $var3 & $var1 & $var2, @SystemDir, @SW_SHOW) "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 11, 2018 Moderators Share Posted April 11, 2018 $var1 = "C:\\Windows\\System32\\Enstart64.exe" $var2 = " GET version" $var3 = " datafile where name='" ConsoleWrite("wmic.exe" & $var3 & $var1 & $var2 & @CRLF) Does the output from this ^^^ look the same as how you would type it manually in a command prompt? "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...
Developers Jos Posted April 11, 2018 Developers Share Posted April 11, 2018 Thought I was clear enough ...guess not. 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...
Moderators JLogan3o13 Posted April 11, 2018 Moderators Share Posted April 11, 2018 Trying to get him to the same point "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...
LisHawj Posted April 11, 2018 Author Share Posted April 11, 2018 @Jos and @JLogan3o13, Thank you for your patience, LOL. I know you run into folks like me all the time, but I applaud your generosity with your knowledge. Please keep making new scripter like myself work harder to learn the trade while at the same time nudging us in the right direction. I have FOUND the culprit with your help! Thank you!!! $var1 = "C:\\Windows\\System32\\Enstart64.exe'" $var2 = " GET version" $var3 = " datafile where name='" $iVer =RunWait(@ComSpec & " /k " & "wmic.exe" & $var3 & $var1 & $var2, @SystemDir, @SW_SHOW) MsgBox(0,"", $iVer) Earthshine 1 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