Sign in to follow this  
Followers 0
SaintedRogue

Running a Command not finding PATH

15 posts in this topic

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?

Share this post


Link to post
Share on other sites



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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by SaintedRogue

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

That's the thing, I am seeing what I want. And the command works, just not in the script for some reason.

Share this post


Link to post
Share on other sites

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                                      3

I 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                                      4

Are you sure you see what you need in that MsgBox rather than what you want to see? :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (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 by SaintedRogue

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Yeah, I cannot find the error. The syntax is right. Just doesn't seem like it want's to run. Rather frustrating.

Share this post


Link to post
Share on other sites

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!

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