Page 1 of 1

BAT does no start AHK when put in Startup folder of Windows 10 [SOLVED]

Posted: 04 Jun 2023 03:06
by DOSadnie
An AHK file with such content

Code: Select all

start "" "C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\SCRIPTStest.ahk"
works A-OK when I execute it by hand. But when I put in

C:\Users\YOUR-USER-NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

folder an LNK leading to such BAT then it will not start itself automatically after resetting the system, even if I select for it

Properties > Advanced > Run as Administrator

from its shell menu


Why is that and how to avert this inability? This isn't the first time I have a problem with a link put in the Startup folder leading to some executable file - in a matter of fact this is exactly why I have inserted there a shortcut leading to this intermediary batch file instead of an LNK leading directly to AutoHotkey script file

Re: BAT does no start AHK when put in Startup folder of Windows 10

Posted: 25 Jun 2023 08:04
by DOSadnie
DOSadnie wrote:
04 Jun 2023 03:06
[...]
Why is that and how to avert this inability?
[...]
Well, does anyone happen to know?

Re: BAT does no start AHK when put in Startup folder of Windows 10

Posted: 25 Jun 2023 09:03
by miskox
Why don't you just execute:

Code: Select all

"C:\Program Files\AutoHotkey\AutoHotkey.exe" "C:\SCRIPTStest.ahk"
Saso

Re: BAT does no start AHK when put in Startup folder of Windows 10

Posted: 01 Jul 2023 11:01
by DOSadnie
Because it works even worse: it leaves CMD window opened despite adding the script

Code: Select all

exit /B
at its end - present until I close this window manually or in whatever way that AHK script. And it also does not auto-start the AHK in question after reset of the system


But what does work is this variant

Code: Select all

Start "" "C:\SCRIPTStest.ahk"
but only if the LNK leading to put in the Startup system folder it is not set to Run as Administrator


Thank you for trying to help

Re: [SOLVED] BAT does no start AHK when put in Startup folder of Windows 10

Posted: 22 Jul 2023 01:14
by GeoffVass
In the Start command, the first parameter is the title of the window being spawned, but actually it hardly ever shows up. Nevertheless I find it more reliable to have an actual title, eg

Code: Select all

Start "Title" [Command]
Start "" is unreliable I think.