Jump to content

Recommended Posts

Posted

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 ]---
  • Developers
Posted

$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.
  :)

  • Developers
Posted

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

Posted

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.

Posted

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

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
  • Recently Browsing   0 members

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