JeffAllenNJ Posted October 6, 2023 Posted October 6, 2023 (edited) This code: $script = StringSplit(@ScriptName, '.') $link = '%appdata%\Microsoft\Windows\Start Menu\Programs\Startup\' & $script[1] & '.lnk' ConsoleWrite('path: ' & @ScriptFullPath & @CRLF) ConsoleWrite('link: ' & $link & @CRLF) If Not FileExists($link) Then If MsgBox($MB_YESNO, $script[1], 'Add ' & $script[1] & ' to startup?', 'Y') = $IDYES Then FileCreateShortcut(@ScriptFullPath,$link) ConsoleWrite(@error&' @error'&@CRLF&@extended&' @extended'&@CRLF) EndIf EndIf Yields: path: C:\Users\jallen\Documents\AutoIT\SmartCapsLock.au3 link: %appdata%\Microsoft\Windows\Start Menu\Programs\Startup\SmartCapsLock.lnk 0 @error 0 @extended I don't think it's a priv thing because (a) it's my own startup folder (b) I can create the shortcut manually in explorer and (c) I HAVE ADMIN! Edited October 6, 2023 by jaja714 add $script = StringSplit(@ScriptName, '.')
JeffAllenNJ Posted October 6, 2023 Author Posted October 6, 2023 SOLVED! %appdata% doesn't work for autoit so I replaced it with @AppDataDir.
rudi Posted October 12, 2023 Posted October 12, 2023 Hi, there is a more usefull macro for your task: @StartupCommonDir Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now