wetin
wetin

Reputation: 438

AHK Run command with directory path containing space

Using AHK script to open up and launch text files (or script files) within notepad++. I recently had to add spaces to my file path which has caused the problems I now experience. It's as if the space in the file path is escaping the command.

e.g.

Run % "notepad++.exe C:\C Docs\SW\AHK\Desktop1.ahk"

Upon running the above line, it will ask in msgbox: "C:\C" doesn't exist. Create it?

This script happens to be the script location itself. So I also tried the following without success (produces same message):

Run % "notepad++.exe " . a_scriptdir . "\" . A_ScriptName

Upvotes: 0

Views: 1245

Answers (2)

0x464e
0x464e

Reputation: 6489

You are passing two arguments to Notepad++ the first one being C:\C and the second one being Docs\SW\AHK\Desktop1.ahk.
To pass them as one argument, do what you'd always do with command line arguments, quote them.

Run, % "notepad++.exe ""C:\C Docs\SW\AHK\Desktop1.ahk"""

Upvotes: 3

Helpers
Helpers

Reputation: 11

Try like this:

Run notepad++.exe "C:\C Docs\SW\AHK\Desktop1.ahk"

Upvotes: 1

Related Questions