Nisha
Nisha

Reputation: 1843

Why cant I run my application with a default file like that of notepad?

Why cant I run my application with a default file like that of Notepad ? AutoIt sample code below :

 Example()

 Func Example()
        ; Run Notepad
        Run("Notepad.exe " & "C:\Users\judith_francis\Desktop\dd.txt")

        Run("C:\Program Files (x86)\abc\abc.exe" & "C:\Users\xyz\Desktop\test_image.tif")

 EndFunc

Upvotes: 0

Views: 70

Answers (1)

Richard
Richard

Reputation: 1121

This line:

Run("C:\Program Files (x86)\abc\abc.exe" & "C:\Users\xyz\Desktop\test_image.tif")

Runs the command

C:\Program Files (x86)\abc\abc.exeC:\Users\xyz\Desktop\test_image.tif

Which Windows will interpret as

C:\Program

Try instead

  Run('"C:\Program Files (x86)\abc\abc.exe" ' & '"C:\Users\xyz\Desktop\test_image.tif"')

Which adds the necessary space & quotes & will be executed as

"C:\Program Files (x86)\abc\abc.exe" "C:\Users\xyz\Desktop\test_image.tif"

Upvotes: 2

Related Questions