Coucz
Coucz

Reputation: 11

How to open ahk script with space in name by x.bat file

I have xxx.bat file to open few programs by one click. Inside have:

@set AHK_PATH=%PROGRAMFILES%\AutoHotkey\AutoHotkey.exe

@set SCRIPT_PATH=myscript.ahk

@set SCRIPT_ALIAS=myscript have spaces

@set TEXT=This is a CMD script. Use "%SCRIPT_ALIAS%" to run it.

doskey %SCRIPT_ALIAS%="%AHK_PATH%" "%SCRIPT_PATH%" $

%COMSPEC% /k "echo %TEXT%"

Before I try to use standard syntax:

cd pathfile
start x.ahk

But that isn't working, then I decided to look for the correct syntax and found what was above.

The first problem is that doskey does not support spaces in the script name. The second is that even if I change the name of a file, I have to trigger it by typing its alias on the command line. Is there any simpler method to call ahk script that has spaces in its name?

Translate by Google Translator.

Upvotes: 0

Views: 309

Answers (1)

Coucz
Coucz

Reputation: 11

Thank you for you answer guys. Thanks to this, I learned a few things, unfortunately this knowledge did not help me much in solving the problem. I decided to look for a solution again and I managed to find a very simple solution, which I present below for posterity.

cd /D "D:\script_folder_path\"
start "" /B "C:\Program Files\AutoHotkey\AutoHotkey.exe" "name with spaces.ahk"

Upvotes: 1

Related Questions