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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
DOSadnie
Posts: 143
Joined: 21 Jul 2022 15:12
Location: Coding Kindergarten

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

#1 Post by DOSadnie » 04 Jun 2023 03:06

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
Last edited by DOSadnie on 24 Jul 2023 09:12, edited 3 times in total.

DOSadnie
Posts: 143
Joined: 21 Jul 2022 15:12
Location: Coding Kindergarten

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

#2 Post by DOSadnie » 25 Jun 2023 08:04

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

miskox
Posts: 553
Joined: 28 Jun 2010 03:46

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

#3 Post by miskox » 25 Jun 2023 09:03

Why don't you just execute:

Code: Select all

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

DOSadnie
Posts: 143
Joined: 21 Jul 2022 15:12
Location: Coding Kindergarten

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

#4 Post by DOSadnie » 01 Jul 2023 11:01

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

GeoffVass
Posts: 10
Joined: 04 Oct 2021 17:34

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

#5 Post by GeoffVass » 22 Jul 2023 01:14

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.

Post Reply