That works; thank you!
Last time I tried using ..\ I didn't seem to have any luck, but that could've been because I had an improper variable included...
I'd still like to see %A_UserName% included though
This may help others too:
Libraries folder; this is where things such as gdip should go...
The setup directory; it houses any files needing to be copied in addition to the setup bat file...
- AutoHotkey.ahk - Thanks wolf_II
Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus
:: Setup AHK on this PC - Josh 'Acecool' Moser
:: Path to where your cloud program stores files...
:: Path, from CloudPath, where you store your AHK Files...
:: Path, from CloudPath, where you store your library Files...
:: Path, from CloudPath, where you store the AHK Setup Files...
:: AHK Installation Dir
set AHKInstallPath=C:\Program Files\AutoHotkey
echo Please verify the following paths before continuing... If incorrect, close the command prompt and make the appropriate changes before relaunching..
echo Cloud Path: %CloudPath%
echo Cloud AHK Files Path: %CloudPath%%CloudAHKPath%
echo Cloud AHK Libraries Path: %CloudPath%%CloudAHKLibPath%
echo Cloud Setup Files Path: %CloudPath%%CloudAHKSetupPath%
echo AHK Installation Path: %AHKInstallPath%
:: Setup our backup file-name
set FileName=Backup %date%%t%
:: Paths to important locations...
set AHKPath=C:\Program Files\AutoHotkey
:: Check to see if the libraries directory has already been created ( unlikely )
echo Checking to see if the Libraries folder exists in the AHK Installation Directory: %AHKPath%
if exist "%LibPath%" (
:: It has, rename it...
echo Renaming "%LibPath%" to "\Lib %FileName%"
rename "%AHKInstallPath%\Lib" "Lib %FileName%"
) else (
echo "%LibPath%" wasn't found..
:: Create our symbolic link...
echo Trying to create our symbolic link...
mklink /D "%AHKInstallPath%\Lib" "%CloudPath%%CloudAHKLibPath%"
:: Read Registry...
echo. Reading the registry for the "My Documents" or "Documents" folder, including other languages, location...
FOR /F "usebackq tokens=2,* skip=2" %%L IN (
`reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v Personal`
) DO SET DocumentsPath=%%M
:: Output Value...
echo Documents Folder Found: %DocumentsPath%
:: Check to see if AutoHotkey.ahk exists in the docs folder..
if exist "%DocumentsPath%\AutoHotkey.ahk" (
:: It does, so rename the default file, or whatever, to something else...
echo Renaming "%DocumentsPath%\AutoHotkey.ahk" to "\AutoHotkey %FileName%.ahk"
rename "%DocumentsPath%\AutoHotkey.ahk" "AutoHotkey %FileName%.ahk"
) else (
echo AutoHotkey.ahk wasn't found.. Copying the new one into %DocumentsPath%
:: Now, copy our loader file to the proper location..
copy "%CloudPath%%CloudAHKSetupPath%\AutoHotkey.ahk" "%DocumentsPath%"
All of this is dynamic aside from the base folder structure for DropBox... You can put any contents into your AutoHotkey.ahk file inside Dropbox\AutoHotkey\Setup\ and on new machines just run the bat file to have the file copied to my documents ( any existing file will be renamed for backup purposes ), and the libraries symbolic link will be created inside of the AHK installation dir ( any existing folder will be renamed for backup purposes )... Then just run autohotkey.exe - simple...
I'm still hoping to see %A_UserName% included...
Edit: Added config options..