Sign in to follow this  
Followers 0
ioliver

Using the Run() Command - Quick Question

15 posts in this topic

I'm trying to run this line:

Run(@ComSpec & " /c program files\common files\microsoft shared\_
  msinfo\msinfo32 /report c:\msinfo32.txt /computer " & $objComputer & _
  " /categories systemsummary", @SW_HIDE)

But I can't seem to get it. Can anyone tell me if I'm missing someting?

Thanks,

Ian


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

Share this post


Link to post
Share on other sites



I've tried it a couple of different ways, the following being one of them:

RunWait(@Comspec "/c" & "start ""MSINFO32.EXE"" /D""c:\program files\common files\microsoft shared\msinfo"" msinfo32 /report c:\msinfo32.txt /computer " & $objComputer & " /categories systemsummary", "", @SW_HIDE)

And I still can't seem to get it.

Thanks again,

Ian


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I've tried it a couple of different ways, the following being one of them:

RunWait(@Comspec "/c" & "start ""MSINFO32.EXE"" /D""c:\program files\common files\microsoft shared\msinfo"" msinfo32 /report c:\msinfo32.txt /computer " & $objComputer & " /categories systemsummary", "", @SW_HIDE)

And I still can't seem to get it.

Thanks again,

Ian

Can you show the exact command line you want, as you would type it into the command line (ie. not in autoit format)? Edited by Jon

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer COMPUTERNAME /categories systemsummary

The above command works from a command prompt, with of course, COMPUTERNAME being a vaild computername on your network.

Thanks for you help.

Edited by ioliver

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

Share this post


Link to post
Share on other sites

I've tried it a couple of different ways, the following being one of them:

RunWait(@Comspec "/c" & "start ""MSINFO32.EXE"" /D""c:\program files\common files\microsoft shared\msinfo"" msinfo32 /report c:\msinfo32.txt /computer " & $objComputer & " /categories systemsummary", "", @SW_HIDE)

And I still can't seem to get it.

Thanks again,

Ian

<{POST_SNAPBACK}>

This one works:

Run(@ComSpec & ' /c "' & @ProgramFilesDir & _
 '\common files\microsoft shared\msinfo\msinfo32" /report c:\msinfo32.txt /computer ' _
 & $objComputer & ' /categories systemsummary',"", @SW_HIDE)

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer COMPUTERNAME /categories systemsummary

The above command works from a command prompt, with of course, COMPUTERNAME being a vaild computername on your network.

Thanks for you help.

RunWait(@ComSpec & ' /c start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ' & $objComputer & ' /categories systemsummary')

Edit: Damnit. :ph34r:

Edited by Jon

Share this post


Link to post
Share on other sites

Thanks for all you help. That part is working ok, but I'm getting buggy results from the rest of the script.

; System Inventory.au3
; September 10, 2004

If FileExists("c:\msinfo32.txt") Then
  FileDelete("c:\msinfo32.txt")
EndIf

$txtComputers = FileOpen("C:\computers.txt", 0)
While 1
  $x = $x + 1
  $objComputer = FileReadLine($txtComputers, $x)
  If @error = -1 Then ExitLoop
  MsgBox(0, "Computer Name:", $objComputer); *Used for testing
  RunWait(@ComSpec & ' /c start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ' & $objComputer & ' /categories systemsummary')
  Do
    MsgBox(0, "System Inventory", "msinfo32.txt does not exist yet!"); *Used for testing
    Sleep(500)
  Until FileExists("c:\msinfo32.txt")
  MsgBox(0, "System Inventory", "msinfo32.txt exists!"); *Used for testing
Wend
FileClose($txtComputers)

If you have time to look at it, I could use the help. The "c:\computers.txt" file is just a txt file with a list of computer names, 1 per line. Eventually the script will read the report created from MSINFO32 and transfer some of the data there to a SpreadSheet (CSV) or to a Database.

Thanks again.


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

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Thanks for all you help.  That part is working ok, but I'm getting buggy results from the rest of the script.

If you have time to look at it, I could use the help.  The "c:\computers.txt" file is just a txt file with a list of computer names, 1 per line.  Eventually the script will read the report created from MSINFO32 and transfer some of the data there to a SpreadSheet (CSV) or to a Database.

Thanks again.

<{POST_SNAPBACK}>

Only thing i would do different is the FileReadLine, just use it without the recordnumber so it will read the next record...

What is the issue you have with it ??

; System Inventory.au3
; September 10, 2004

If FileExists("c:\msinfo32.txt") Then
   FileDelete("c:\msinfo32.txt")
EndIf

$txtComputers = FileOpen("C:\computers.txt", 0)
While 1
   $objComputer = FileReadLine($txtComputers)
   If @error = -1 Then ExitLoop
   MsgBox(0, "Computer Name:", $objComputer); *Used for testing
   RunWait(@ComSpec & ' /c start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ' & $objComputer & ' /categories systemsummary')
   Do
      MsgBox(0, "System Inventory", "msinfo32.txt does not exist yet!"); *Used for testing
      Sleep(500)
   Until FileExists("c:\msinfo32.txt")
   MsgBox(0, "System Inventory", "msinfo32.txt exists!"); *Used for testing
Wend
FileClose($txtComputers)

p.s. and ofcource use my version of the RunWait()... :ph34r:

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Only thing i would do different is the FileReadLine, just use it without the recordnumber so it will read the next record...

What is the issue you have with it ??

Thanks, I'll try that out on Monday and let you know how it works. That may take care of it b/c one of the problems I was having was getting varying results for the $objComputer variable, when it should be returning a consistent result.

Thanks again,

Ian


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

Share this post


Link to post
Share on other sites

Ok, here's what's happening....

The msinfo32.txt file that is created by script gives the followng results:

System Information report written at: 09/13/04 08:11:08

System Name: NSSPCTECH1

[system Summary]

Can't Collect Information

But, if I run MSINFO32.exe from a command line, like what I'm trying to do in the script "start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ADMBOARDROOM /categories systemsummary", I get the following, which is correct:

System Information report written at: 09/13/04 08:11:53

System Name: NSSPCTECH1

[system Summary]

Item Value

OS Name Microsoft Windows 2000 Professional

Version 5.0.2195 Service Pack 4 Build 2195

OS Manufacturer Microsoft Corporation

System Name ADMBOARDROOM

System Manufacturer Dell Computer Corporation

System Model Inspiron 2500

System Type X86-based PC

Processor x86 Family 6 Model 8 Stepping 10 GenuineIntel ~996 Mhz

BIOS Version/Date Phoenix Technologies LTD A11, 12/3/2001

SMBIOS Version 2.3

Windows Directory C:\WINNT

System Directory C:\WINNT\system32

Boot Device \Device\Harddisk0\Partition1

Locale United States

Hardware Abstraction Layer Version = "5.00.2195.6691"

User Name Not Available

Time Zone Central Daylight Time

Total Physical Memory 256.00 MB

Available Physical Memory 119.01 MB

Total Virtual Memory 869.27 MB

Available Virtual Memory 636.11 MB

Page File Space 615.29 MB

Page File C:\pagefile.sys

I think the problem is of course, somewhere with this part of the script

$objComputer = FileReadLine($txtComputers)
   If @error = -1 Then ExitLoop
   MsgBox(0, "Computer Name:", $objComputer); *Used for testing
   RunWait(@ComSpec & ' /c start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ' & $objComputer & ' /categories systemsummary')

Any help is appericated, Thanks again,

Ian


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

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

A couple of days ago, I figured out the correct syntax for the "Start" command.

This is how you should use it

START "Some title" /WAIT MSINFO32.EXE

That "/WAIT" is optional and mostly used in BATCH files

I'll try to fix your script....

This is weird. First it didn't work and now it worked three times in a row.

Here is my test script.

Opt("TrayIconHide", 1);Else I will keep staring at the icon :D
;$objComputer = FileReadLine($txtComputers)
$objComputer = @ComputerName;For testing...
   If @error = -1 Then ExitLoop
   MsgBox(0, "Computer Name:", $objComputer); *Used for testing
   RunWait(@ComSpec & ' /c Start "Please Wait..." MSINFO32.EXE /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ' & $objComputer & ' /categories systemsummary', '', @SW_HIDE)
Sleep(1000)
RunWait("notepad c:\msinfo32.txt")
Sleep(1000)
FileDelete("c:\msinfo32.txt")
Edited by SlimShady

Share this post


Link to post
Share on other sites

Thanks for your help. I'm not sure if you're asking me to use the /Wait or not?

Ian


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

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Thanks for your help.  I'm not sure if you're asking me to use the /Wait or not?

Ian

<{POST_SNAPBACK}>

No. It's just information of what I've figured out.

People here (me too) had problems with using the START command to start a file with their associated application.

This is incorrect:

Run(@ComSpec & ' /c START "C:\Program Files\AutoIt3\COPYING.txt"')

And this is correct:

Run(@ComSpec & ' /c START "Please Wait..." "C:\Program Files\AutoIt3\COPYING.txt"')

Edit:

Eureka!

I now totally understand. We used double quotes when using path names with spaces.

And the command interpreter assumed it was the title because of the quotes.

Use my test script I posted earlier.

Edited by SlimShady

Share this post


Link to post
Share on other sites

I tried to test your script, but it errors because I don't have computers.txt... where is this file generated from? What information is it supposed to hold?

The error that I got was:

File handle invalid.  Make sure that the FileOpen command succeeded.

It errors on:

$objComputer = FileReadLine($txtComputers)

To fix this problem, and avoid the possible error I suggest:

; System Inventory.au3
; September 10, 2004

If FileExists("c:\msinfo32.txt") Then
   FileDelete("c:\msinfo32.txt")
EndIf

$txtComputers = FileOpen("C:\computers.txt", 0)

If ( $txtComputers = -1 ) Then Exit; *** If computers.txt does not exist then exit

While 1
   $objComputer = FileReadLine($txtComputers)
   If @error = -1 Then ExitLoop
   MsgBox(0, "Computer Name:", $objComputer); *Used for testing
   RunWait(@ComSpec & ' /c start "MSINFO32.EXE" /D"c:\program files\common files\microsoft shared\msinfo" msinfo32 /report c:\msinfo32.txt /computer ' & $objComputer & ' /categories systemsummary')
   Do
      MsgBox(0, "System Inventory", "msinfo32.txt does not exist yet!"); *Used for testing
      Sleep(500)
   Until FileExists("c:\msinfo32.txt")
   MsgBox(0, "System Inventory", "msinfo32.txt exists!"); *Used for testing
Wend
FileClose($txtComputers)

When I figure out where computers.txt is coming from I will try to help you more, but for now I can't even test your script.

*** Matt @ MPCS

Share this post


Link to post
Share on other sites

Thanks Matt. The "c:\computers.txt" file is just a txt file with a list of computer names, 1 per line. But, so far, thanks to the above posts, what I have is working. But, I'm still working on the rest. So, I may be back.

Thanks again,

Ian


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

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