Jump to content

Run command


sandyd
 Share

Recommended Posts

Hi all,

First post to this forum so dont be too harsh on me.

I have the following code:

$infilename = @TempDir & "\list.txt"
... put some text into list.txt ...
Run("c:\windows\notepad.exe" & $infilename)

The error msg i get is:

Line 37 (File "G:\Scripts\NewMachinesOnNetwork.aut"):

Run("c:\windows\notepad.exe" & $infilename)

Error: Unable to execute the external program.

The filename, directory name, or volume label syntax is incorrect.

Am I using the wrong syntax for the Run command? How can I get notepad to open my file?

Sandy

----[ SandyD ]---
Link to comment
Share on other sites

What I would do is...

Run(@ComSpec & " /c start " & $infilename)

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Developers

$infilename = @TempDir & "\list.txt"
... put some text into list.txt ...
Run("c:\windows\notepad.exe" & $infilename)

The error msg i get is:

Line 37  (File "G:\Scripts\NewMachinesOnNetwork.aut"):

Run("c:\windows\notepad.exe" & $infilename)

Error: Unable to execute the external program.

The filename, directory name, or volume label syntax is incorrect.

Am I using the wrong syntax for the Run command? How can I get notepad to open my file?

Sandy

<{POST_SNAPBACK}>

:) AUT ?????

Run command should be:

Run('c:\windows\notepad.exe "' & $infilename & '"')

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

What about my example guys? Does everyone prefer not to use the @ComSpec and if so why?

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

  • Developers

What about my example guys? Does everyone prefer not to use the @ComSpec and if so why?

JS

<{POST_SNAPBACK}>

Your post will use the default program for extention ".txt"

I don't prefer using @comspec... use it for commandline programs but not for Windows programs if not needed.

I guess the reason of my post was to show how to correctly do what was tried in the initial post.

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

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...