In that thread, expert Joe Winograd provided a solution which involves creating an AutoHotkey (ahk) "Run" command (which I know how to do) then compiling the resulting .ahk file to create an .exe file. That was a great solution and I'm glad to now know how to do that. However, since closing the previous thread, I've realized that that solution is not practical for the specific purpose* that prompted my question.
As a result, I'm back to my original question which is:
How do you directly create an executable file (.exe or .cmd) to open a non-executable file (.xlsm, .txt, .ahk, etc)?
In the previous thread, expert tuvi suggested putting the following in a .cmd file:
Unfortunately, while I know how to place a command in the cmd/prompt/DOS window (not sure what it's called), I do not know how to create a .cmd or .exe file. I tried simply pasting the above line in a Notepad window then saving it, first with a .cmd extension and then with an .exe extension but neither of those worked.
It seems like something I should know how to do but that's why I'm happy all of you great experts are available to answer questions. :)
Thanks
*The main reason I'm looking for a different solution is that the 2-3 scripts (.ahk files) involved are frequently updated and having changes made. Consequently, the process of creating then running a new matching .exe file each time an .ahk file is changed, takes more time than simply manually opening the .ahk file in the first place — which is what I'm attempting to avoid if possible.
A ____________________ [A LOT OF SPACE] ____________________ LOT
"ALOT" is not a word — it never has been a word and it never will be a word.
"A LOT" is two words. Remember it as though there's [A LOT OF SPACE] between them.
It's worked once or twice with test folders/files but then still doesn't work with existing files.
Is any part of it case-sensitive or are spaces and/or hyphens prohibited in folder names and/or filenames?
Joe Winograd
It is not case sensitive. Hyphens are fine in folder/file names. If there are spaces anywhere in the fully qualified file name, see my previous comment. Please post the batch file that you are using.
Qlemo
If it does not work, it can only be an issue with the path or file itself. Did you enter the full path and file name, including extension? Does the file open correctly if you double-click on it in Explorer?
I have to admit, that I don't understand the basic problem. Cause when you can enter an executable, you can simply also enter any file name, which has a registered shell extension...
NVIT
Do you still need help with this?
The main reason I'm looking for a different solution is that the 2-3 scripts (.ahk files) involved are frequently updated and having changes made.
What kind of changes? Maybe passing those changes as arguments to the exe is a solution?
by opening a commandline or you could and enter the tex above, you actually create an executeable file named "executethis.cmd" in c:\temp (if you have that folder under c:\) that opens the doc or xlsm.
I mean your question is strange, because you could even just enter the file with the whole path in the commandline and it would open.
why do you need an executable that opens a file which windows recoginses anyway as known filetype and executes it with the proper program?
the heck..I have no clue why you wanna do this. there is no explanational reason, please enlighten us for what purpose you need that exactly and we will help.
if you need vb code, there it will be ShellExecute to open it, but you still only need the file, no executable before it...
It's worked once or twice with test folders/files but then still doesn't work with existing files.
Is any part of it case-sensitive or are spaces and/or hyphens prohibited in folder names and/or filenames?