Kill the following lines of code:
21 ; Contributions: Using "GetRoot" instead of "c:\" has been adapted from the project "goodbye microsoft" from Robert Millan
59 !include FileFunc.nsh ; GetRoot / un.GetRoot
60 !insertmacro GetRoot
61 !insertmacro un.GetRoot
108 ${GetRoot} $WINDIR $c
109 StrCpy $INSTDIR "$c"
129 SetOutPath $INSTDIR
122 InstallDir "$c\"
192 ${un.GetRoot} $WINDIR $c
Insert the following code:
129 !insertmacro GetPath
192 !insertmacro GetPath
Then, somewhere near your Functions insert the following:
!macro GetPath
IfFileExists "C:\autoexec.bat" 0 +3
StrCpy $c "C:"
Goto lbl_path
IfFileExists "D:\autoexec.bat" 0 +3
StrCpy $c "D:"
Goto lbl_path
IfFileExists "E:\autoexec.bat" 0 +3
StrCpy $c "E:"
Goto lbl_path
IfFileExists "F:\autoexec.bat" 0 +3
StrCpy $c "F:"
Goto lbl_path
IfFileExists "G:\autoexec.bat" 0 +3
StrCpy $c "G:"
Goto lbl_path
IfFileExists "H:\autoexec.bat" 0 +3
StrCpy $c "H:"
Goto lbl_path
IfFileExists "I:\autoexec.bat" 0 +3
StrCpy $c "I:"
Goto lbl_path
IfFileExists "J:\autoexec.bat" 0 +3
StrCpy $c "J:"
Goto lbl_path
IfFileExists "K:\autoexec.bat" 0 +3
StrCpy $c "K:"
Goto lbl_path
IfFileExists "L:\autoexec.bat" 0 +3
StrCpy $c "L:"
Goto lbl_path
IfFileExists "M:\autoexec.bat" 0 +3
StrCpy $c "M:"
Goto lbl_path
IfFileExists "N:\autoexec.bat" 0 +3
StrCpy $c "N:"
Goto lbl_path
IfFileExists "O:\autoexec.bat" 0 +3
StrCpy $c "O:"
Goto lbl_path
IfFileExists "P:\autoexec.bat" 0 +3
StrCpy $c "P:"
Goto lbl_path
IfFileExists "Q:\autoexec.bat" 0 +3
StrCpy $c "Q:"
Goto lbl_path
IfFileExists "R:\autoexec.bat" 0 +3
StrCpy $c "R:"
Goto lbl_path
IfFileExists "S:\autoexec.bat" 0 +3
StrCpy $c "S:"
Goto lbl_path
IfFileExists "T:\autoexec.bat" 0 +3
StrCpy $c "T:"
Goto lbl_path
IfFileExists "U:\autoexec.bat" 0 +3
StrCpy $c "U:"
Goto lbl_path
IfFileExists "V:\autoexec.bat" 0 +3
StrCpy $c "V:"
Goto lbl_path
IfFileExists "W:\autoexec.bat" 0 +3
StrCpy $c "W:"
Goto lbl_path
IfFileExists "X:\autoexec.bat" 0 +3
StrCpy $c "X:"
Goto lbl_path
IfFileExists "Y:\autoexec.bat" 0 +3
StrCpy $c "Y:"
Goto lbl_path
IfFileExists "Z:\autoexec.bat" 0 +3
StrCpy $c "Z:"
lbl_path:
SetOutPath "$c"
!macroend
In all reality you don't need go to Z:\ but for the sake of consistency I did...I'm sure no one would go higher than F:\ in real life