SaintedRogue Posted January 4, 2012 Share Posted January 4, 2012 OK, so I am trying to run a command. But, it seems that I'm not finding the proper path. The tool that needs to run is in a folder in the ScriptDir. But I cannot seem to be able run anything in that folder. It seems like I have everything right, but I'm not sure. Are my quotations messed up, maybe? Here is the code: if(GuiCtrlRead($SysInfo) = 1) then ; Gather System Information RunWait(@ComSpec & ' /c systeminfo > "' & $ReportsDir & '\System Info.txt"') RunWait(@ComSpec & ' /c "' & @ScriptDir & '\SysinternalsSuite\psinfo -accepteula >> "' & $ReportsDir & '\System Info.txt"') EndIf Ideas/Thoughts? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 4, 2012 Moderators Share Posted January 4, 2012 SaintedRogue,No promises, but try this:RunWait(@ComSpec & ' /c "' & @ScriptDir & 'SysinternalsSuitepsinfo -accepteula" >> "' & $ReportsDir & 'System Info.txt"')I always use ConsoleWrite to check long command strings like this to make sure of the quotes. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 (edited) M23, No such luck. I send the command to a MsgBox() and I see the right output. I even put it into a command prompt and it worked... but it's not working in the script for some reason. Maybe I cannot use 2 run commands? Edited January 4, 2012 by SaintedRogue Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 4, 2012 Moderators Share Posted January 4, 2012 SaintedRogue,So write out what you would have to enter at the command prompt to run corerctly and then use ConsoleWrite on the string to see if you are getting what you need. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 That's the thing, I am seeing what I want. And the command works, just not in the script for some reason. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 4, 2012 Moderators Share Posted January 4, 2012 SaintedRogue,The string you posted initially has only 3 double-quotes - I doubt that is what you want: C:Windowssystem32cmd.exe /c "M:ProgramAu3 ScriptsSysinternalsSuitepsinfo -accepteula >> "M:ProgramAu3 ScriptsSystem Info.txt" 1 2 3I used @ScriptDir twice as I do not know what your $ReportsDir shoudl be. I added a fourth - but perhaps in the wrong place:C:Windowssystem32cmd.exe /c "M:ProgramAu3 ScriptsSysinternalsSuitepsinfo -accepteula" >> "M:ProgramAu3 ScriptsSystem Info.txt" 1 2 3 4Are you sure you see what you need in that MsgBox rather than what you want to see? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 Sorry, I should have clarified. Your additional quote does make it right, that's what I was then using when I said I was seeing what I want to. And it should work. If I were to copy the command that I outputted in MsgBox, into CMD the command executes. However, it fails without it. I flagged CMD to /k rather than /c and see that it seems to be an issue with the argument. But the argument is correct and again works if I type it in afterwards. Probably shouldn't use MsgBox(), but I'm a newb and it's the easiest thing for me to see the command. Not really sure how to use ConsoleWrite, honestly. Link to comment Share on other sites More sharing options...
JFX Posted January 4, 2012 Share Posted January 4, 2012 what is the output of consolewrite ? ;~ if(GuiCtrlRead($SysInfo) = 1) then ; Gather System Information _RunWait(@ComSpec & ' /c systeminfo > "' & @ScriptDir & '\System Info.txt"') _RunWait(@ComSpec & ' /c "' & @ScriptDir & '\SysinternalsSuite\psinfo" -accepteula >> "' & @ScriptDir & '\System Info.txt"') ;~ EndIf Func _RunWait($var) ConsoleWrite($var & @CRLF) RunWait($var) EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 4, 2012 Moderators Share Posted January 4, 2012 SaintedRogue,If you run your code in SciTE then ConsoleWrite will output into the lower pane of the editor - a very useful little tool. Given your further explanation on how the "correct" string fails I am at a loss as to how I might help any more. Sorry. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 (edited) Yeah, I'm not sure either. Seems to be an issue with the program I'm trying to run. I'll have to play. It's frustrating, because if I put CMD in that folder and then run it, with something like this: RunWait('cmd.exe /c .SysinternalsSuitepsservice -accepteula >> "' & $ReportsDir & 'Services.txt"') It works everytime. But doing that I have to have CMD in the folder and I think that's kind of lazy. I wanted to see if I could find a way around it. Thank you very much for your input, M23. Edited January 4, 2012 by SaintedRogue Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 4, 2012 Moderators Share Posted January 4, 2012 SaintedRogue,So what does @ComSpec come up as when you do this: ConsoleWrite(@ComSpec & @CRLF)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 Hey! ConsoleWrite is pretty handy! I get: C:\Windows\System32\cmd.exe So the command ran, is : C:\Windows\System32\cmd.exe /k "C:UsersAhrendtDocumentsForensicIRSysinternalsSuitepsinfo -s -d -accepteula" > "C:UsersAhrendtDocumentsForensicIR01-04-2012 ReportsSystem Info.txt" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 4, 2012 Moderators Share Posted January 4, 2012 SaintedRogue, Well at least I showed you something out of all this! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 Yeah, I cannot find the error. The syntax is right. Just doesn't seem like it want's to run. Rather frustrating. Link to comment Share on other sites More sharing options...
SaintedRogue Posted January 4, 2012 Author Share Posted January 4, 2012 Interesting... I use the command for other tools in the folder and it works. I think it's definitely an issue with the tool, and neither of us. Thanks, again! Link to comment Share on other sites More sharing options...
Funtime60 Posted July 27, 2023 Share Posted July 27, 2023 I know this is old but since google led me here when I had a similar issue and nothing else matched, I thought I'd mention the solution in my case. The program I was trying to use in my case wasn't on the path, but I didn't remember to restart SciTE after I added it. So every time SciTE launched my script my script would then launch CMD with an outdated path. hope this helps. 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