Sign in to follow this  
Followers 0
sandyd

Run command

8 posts in this topic

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

Share this post


Link to post
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)

Share this post


Link to post
Share on other sites

$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 & '"')


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

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)

Share this post


Link to post
Share on other sites

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.


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

Thanks JdeB... that explains it. :)

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)

Share this post


Link to post
Share on other sites

also Start has a problem with path statements used that way.

Try this out.

$file="C:\WINNT\Active Setup Log.txt"
run(@comspec &' /c start ' & $file)
;or
run(@comspec &' /c start "' & $file & '"')

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites

Thanks to everyone that replied.

Had looked at it that much, I'd never noticed that I needed a space between notepad.exe and the filename.

Cheers again

Sandy


----[ SandyD ]---

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