Jump to content

RunWait() Does not pass ">" Correctly


ioliver
 Share

Recommended Posts

Here's my latest:

When I run

psinfo \\computername > c:\psinfo.txt

from a command prompt it works. The command line output from psinfo.exe is redireted to the c:\psinfo.txt file.

But, When I run the following:

Func PSInfo()
  FileInstall("c:\psinfo\psinfo.exe", "c:\psinfo.exe")
  FileInstall("c:\psinfo\pdh.dll", "c:\pdh.dll")
  RunWait(@ComSpec & " /c " & "psinfo.exe \\" & $host & " > c:\psinfo.txt", "", @SW_HIDE)
EndFunc

I think it's passing the ">" as part of the computername. In other words:

psinfo \\"computername > c:\psinfo.txt"

Any ideas on what I should do to pass the command correctly?

If you need more information or I didn't explain the problem correctly, please let me know.

As always, thanks very much for all your help,

Ian

Edited by ioliver

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Here's my latest:

When I run

psinfo \\computername > c:\psinfo.txt

from a command prompt it works.  The command line output from psinfo.exe is redireted to the c:\psinfo.txt file.

But, When I run the following:

Func PSInfo()
  FileInstall("c:\psinfo\psinfo.exe", "c:\psinfo.exe")
  FileInstall("c:\psinfo\pdh.dll", "c:\pdh.dll")
  RunWait(@ComSpec & " /c " & "psinfo.exe \\" & $host & " > c:\psinfo.txt", "", @SW_HIDE)
EndFunc

I think it's passing the ">" as part of the computername.  In other words:

psinfo \\"computername > c:\psinfo.txt"

Any ideas on what I should do to pass the command correctly?

If you need more information or I didn't explain the problem correctly, please let me know.

As always, thanks very much for all your help,

Ian

<{POST_SNAPBACK}>

I suggest putting this in place of the runwait to test it:
msgbox(0,"",@ComSpec & " /c " & "psinfo.exe \\" & $host & " > c:\psinfo.txt")

that'll tell you if it's a showing to the runwait as you want it to

"I'm not even supposed to be here today!" -Dante (Hicks)

Link to comment
Share on other sites

where is psinfo.exe located? in the script directory?

try

RunWait(@ComSpec & " /c " & "c:\psinfo\psinfo.exe \\" & $host & " > c:\psinfo.txt", "", @SW_HIDE)

<{POST_SNAPBACK}>

Larry, I FileInstall() psinfo.exe to c:\, should I still try to run it for c:\psinfo?

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

Works for me....

Can the host name contain spaces?  You might want to try this:

RunWait(@ComSpec & ' /c ' & 'psinfo.exe "\\' & $host & '" > c:\psinfo.txt', '', @SW_HIDE)

<{POST_SNAPBACK}>

I tried doing it your way CyberSlug, My text file is outputted but there is no information inside it...

Ian

"Blessed be the name of the Lord" - Job 1:21Check out Search IMF

Link to comment
Share on other sites

This one worked fine here:

Func PSInfo()
 FileInstall("psinfo.exe", "c:\psinfo.exe")
 FileInstall("pdh.dll", "c:\pdh.dll")
 RunWait(@ComSpec & ' /c c:\psinfo.exe "\\' & $host & '" > c:\psinfo.txt', 'c:\', @SW_HIDE)
EndFunc

Please note: PSInfo does not accept "localhost" or "127.0.0.1" as valid hostnames!!!

Just in case you were trying to test it on your own computer. Take your real hostname or IP address instead.

Greetings,

ZeD

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...