C:\Program' is not recognized as an internal or external command

The popular SciTE-based AutoHotkey Script Editor
MrBill
Posts: 3
Joined: 14 May 2023, 18:24

C:\Program' is not recognized as an internal or external command

Post by MrBill » 14 May 2023, 19:14

Hello,
I'm very new to scripting and I downloaded AutoHotkey since it was easy to learn and quite versatile. I'm also using SciTE4AutoHotkey as the editor. I'm also taking an inline tutorial to learn these products. I coded the "test" script as follows:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#Persistent
#SingleInstance force

MsgBox Hello World
I save this and try to run it and I get the following error message:

>"C:\Program Files\AutoHotkey\AutoHotkey.exe" /ErrorStdOut "C:\Users\wbh2_\Documents\AutoHotkey_Scripts\Test.ahk"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
>Exit code: 1 Time: 0.1055

I know what the problem is, that there is a space in between the words Program and Files in the path command. What I don't know is how to fix it. I've searched this form and have found nothing, I've used the internet to try and find the answer and I've even tried ChatGPT, to no avail. This is very frustrating since I can see the problem but not the solution.

I need help (as a noob)

Thanks in advance for your help!

MrBill


[Mod actions: Moved to the v1 section since this is v1 code (the main section is for v2 code). Added [code][/code] tags. Please use them yourself when posting code.]
[Mod edit: Now moved to the SciTE4AutoHotkey subforum, since this is not about AHK, but the editor.]
User avatar
RDC
Posts: 114
Joined: 29 Jan 2023, 10:22

Re: C:\Program' is not recognized as an internal or external command

Post by RDC » 14 May 2023, 21:18

What you have posted here works for me...

Code: Select all

^T:: 	 ; … …  (Ctrl + T) 	‴‴ HOTKEY ‴‴

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#Persistent
#SingleInstance force

MsgBox Hello World
image.png
image.png (2.9 KiB) Viewed 5355 times
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: C:\Program' is not recognized as an internal or external command

Post by gregster » 14 May 2023, 21:28

Probably SciTE can't find Autohotkey.exe in C:\Program Files\AutoHotkey\. Check for its existence.
MrBill
Posts: 3
Joined: 14 May 2023, 18:24

Re: C:\Program' is not recognized as an internal or external command

Post by MrBill » 15 May 2023, 16:14

It doesn't find it because it's not there...it's in C:\Program Files\AutoHotkey\V2. Is there a way to have SciTE4AutoHotkey point to that? And it uses a .symlink file (Which I assume points to one of the .exe files, i.e. AutoHotkey32, AutoHotkey32_UIA, AutoHotkey64 or AutoHotkey64_UIA). I had a devil of a time trying to install this on the C: drive as opposed to the OneDrive.
Also when I'm in SciTE4AutoHotkey, it won't let me save the script to the Program Files drive, it says I don't have permission.
Why is this so complicated? It should be a download, an install and then use it.

I'm not sure I like Widows 11.

Thanks,

MrBill
User avatar
gregster
Posts: 9224
Joined: 30 Sep 2013, 06:48

Re: C:\Program' is not recognized as an internal or external command

Post by gregster » 15 May 2023, 16:20

Just to be clear, your code above is AHK v1 code - and the AHK interpreter in V2 won't help with that.
How about you install v1 into the expected directory? It can live side-by-side with AHK v2.

Also, if your AHK versions are correctly installed, you can choose a version via the selector icon (the one with the two Hs and the yellow arrows):

version selector.png
version selector.png (5.3 KiB) Viewed 5290 times

Sorry, I have not much experience with widows in IT.
MrBill
Posts: 3
Joined: 14 May 2023, 18:24

Re: C:\Program' is not recognized as an internal or external command

Post by MrBill » 16 May 2023, 10:08

Well, I've learned a bunch in the past 3 or 4 days working with AutoHotkey and Windows 11.
I initially downloaded and installed V2 hoping that the new version work work better than V1. I kept getting the above command error. I even tried the TestSuite.ahk that come with it and got the same command error. I tried to add V1 in addition to V2 and it still didn't work, even though I tried to use the correct version as suggested above (it only showed V2 versions for some reason). But having searched around for a while I got suspicious about V2, so I decided to start over.
I uninstalled all version of AutoHotkey and SciTE4AutHotkey. I then installed V1 only and tried a script already written and it worked! Yay. I then installed SciTE4AutoHotkey and wrote a script. I tried saving it and it said I do not have permission to save in the Program Files directory and asked if I wanted to save it in an area I could access, so I did. I then tried to run the script from the SciTE4AutoHotkey program and nothing happened! From all of the other things I tried (when I had version 2 downloaded) I thought I needed update the permissions in a subfolder under Program Files I was saving the scripts to, so I figured out how to do that. But to no avail.
I then noticed that the TestSuite was really saved as TestSuite.ahk and when I looked at the file I had save it's extension was of file. Even though the save box in SciTE4AutoHotkey said it was an .ahk file it did not save it as such. I then tried to save my script as Test.ahk instead of simply Test. Viola, it worked. I feel like this: :headwall:
So in conclusion, I gotten it to work with version 1 and as long as I save it and include the .ahk file extension it works. Maybe I should try to use Notepad ++ as an IDE instead.
I want to thank this community for taking the time to try and help me when not much information could be conveyed to this forum. It's nice to know you can find help and direction when you need it.
Thanks,
MrBill
User avatar
DataLife
Posts: 464
Joined: 29 Sep 2013, 19:52

Re: C:\Program' is not recognized as an internal or external command

Post by DataLife » 28 Apr 2024, 14:47

MrBill wrote:
16 May 2023, 10:08
Well, I've learned a bunch in the past 3 or 4 days working with AutoHotkey and Windows 11.
I initially downloaded and installed V2 hoping that the new version work work better than V1. I kept getting the above command error. I even tried the TestSuite.ahk that come with it and got the same command error. I tried to add V1 in addition to V2 and it still didn't work, even though I tried to use the correct version as suggested above (it only showed V2 versions for some reason). But having searched around for a while I got suspicious about V2, so I decided to start over.
I uninstalled all version of AutoHotkey and SciTE4AutHotkey. I then installed V1 only and tried a script already written and it worked! Yay. I then installed SciTE4AutoHotkey and wrote a script. I tried saving it and it said I do not have permission to save in the Program Files directory and asked if I wanted to save it in an area I could access, so I did. I then tried to run the script from the SciTE4AutoHotkey program and nothing happened! From all of the other things I tried (when I had version 2 downloaded) I thought I needed update the permissions in a subfolder under Program Files I was saving the scripts to, so I figured out how to do that. But to no avail.
I then noticed that the TestSuite was really saved as TestSuite.ahk and when I looked at the file I had save it's extension was of file. Even though the save box in SciTE4AutoHotkey said it was an .ahk file it did not save it as such. I then tried to save my script as Test.ahk instead of simply Test. Viola, it worked. I feel like this: :headwall:
So in conclusion, I gotten it to work with version 1 and as long as I save it and include the .ahk file extension it works. Maybe I should try to use Notepad ++ as an IDE instead.
I want to thank this community for taking the time to try and help me when not much information could be conveyed to this forum. It's nice to know you can find help and direction when you need it.
Thanks,
MrBill
I also have this problem with Scite4AutoHotkey (Version 3.1.00). Even though "Save as type:" is AutoHotkey scripts (*.ahk) it would save the script without an extension, I have to add .ahk to the filename to save the extension.
Check out my scripts. (MyIpChanger) (ClipBoard Manager) (SavePictureAs)
All my scripts are tested on Windows 10, AutoHotkey 32 bit Ansi unless otherwise stated.
Post Reply

Return to “SciTE4AutoHotkey”