start "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
On 28.06.2023 07:19, Stan Brown wrote:
start "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
Maybe:
start "" "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
On 28.06.2023 07:19, Stan Brown wrote:
start "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
Maybe:
start "" "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
In other words, "/D" was ignored and %AHKDATA% was taken as the
command.
I tested the above command in a command prompt, and it worked just
as intended.
On Wed, 28 Jun 2023 08:18:25 +0200, Herbert Kleebauer
wrote:
On 28.06.2023 07:19, Stan Brown wrote:
start "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
Maybe:
start "" "AutoHotkey" /D %AHKDATA%
"C:\Program Files\AutoHotkey\AutoHotkey.exe" Shortkeys.ahk
Thank you for replying, but it's not clear to me how
that would work at all.
Stan,
In other words, "/D" was ignored and %AHKDATA% was taken as the
command.
No, I don't think that that "/D" was ignored. It just saw an empty path, ended by the space (don't know how the "start" command responds to that, but it might just refuse to try to set an empty "working directory" path). The next argument, in your case the (contents of) "%AHKDATA%" was than - rightfully so - taken as the command and the last two as its arguments.
You might want to enter "start /?" on the commandline and see what it thinks how it should be called. In my case it says "[/Dpath]". Mind you, no space after the "/D".
Though in my case following the "/D" with some (white)space works from both the commandline and a batchfile started from that commandline. Than again, I'm running a bit older version of Windows ...
I tested the above command in a command prompt, and it worked just
as intended.
It might have worked as intended, but not as you thought it did (there is a big difference between those two).
Assuming that your "start" commands "/D" considers the argument terminated
on a (white)space than you should have had the same "%AHKDATA% was taken as the command" problem there too. The only reason I can think of that that didn't happen is that %AHKDATA% variable didn't contain a path, but just (white)space (and was thus skipped).
... At least, in my OS an non-existing environment variable stays as-is in the command (it can't be replaced by its contents because it doesn't exist). If that has changed in Win10 and non-existing environment variables get scrubbed from the command than not (yet) having set that environment
variable would ofcourse give the same effect.
I can't imagine how the /D argument in the start command would
work differently between a batch file run as part of startup
and the same batch file initiated by the user clicking the
shortcut in the Startup folder
Stan,
I can't imagine how the /D argument in the start command would
work differently between a batch file run as part of startup
and the same batch file initiated by the user clicking the
shortcut in the Startup folder
Although I could imagine that, its way to unlikely.
As a test you could try to replace the %AHKDATA% variable with its actual contents and see if you now get the same result. If not than that seems to indicate that that variable is filled later than you think ...
Regards,
Rudy Wieser
As a test you could try to replace the %AHKDATA% variable with its actual contents and see if you now get the same result. If not than that seems to indicate that that variable is filled later than you think ...
As a test you could try to replace the %AHKDATA% variable with its
actual contents and see if you now get the same result.
Well, I could, but I don't think there's any reason to.
Hypothetically speaking, what would happen if
the evaluated %AHKDATA% has a space character in the path ?
Is that whole launch sequence "proofed" against that ?
Or does it need double quotes around it ?
Stan,
As a test you could try to replace the %AHKDATA% variable with its
actual contents and see if you now get the same result.
Well, I could, but I don't think there's any reason to.
Understood.
You already said that you got it running. I just thought you would be curious to the reason of your earlier try not working. At least, that is what your initial post conveyed ...
I _am_ curious, but "environment variables not populated" is not
the cause.
In the same batch file I have a _command_ %KEEPASS% to
open that program. The program does open at login
Therefore I know that environment variables are already populated.
Stan,
I _am_ curious, but "environment variables not populated" is not
the cause.
Besides Murphies Law my own experience tells me that just discarding possiblilites because "that can't ever be it" are a good way to waste lot of time. :-\
Besides, it would take you ... 5 minutes ?
In the same batch file I have a _command_ %KEEPASS% to
open that program. The program does open at login
I read that and I believe you. But to me that /proves/ nothing.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (2 / 14) |
Uptime: | 08:53:57 |
Calls: | 6,666 |
Files: | 12,213 |
Messages: | 5,336,260 |