MNeMiC Posted September 7, 2010 Share Posted September 7, 2010 Okay so I have a bunch of automatic installer scripts that I've done over the years.Now I was forced to convert to Windows7 due to getting an SSD-drive.The problem I'm having now is that all my custom installers create a shortcut in my Windows Directory to allow me to use RUN and just write the name of the shortcut to start the program.To create the shortcut, I use the FileCreateShortcut function.Like this:;Add a shortcut to WINDOWS-directory for fast RUNning $var = @ProgramFilesDir & "\WindowsMenuPlus\WindowsMenuPlus.exe" FileCreateShortcut ($var, @WINDOWSDIR & "\windowmenuplus.lnk") FileCreateShortcut ($var, @WINDOWSDIR & "\wmplus.lnk") FileCreateShortcut ($var, @WINDOWSDIR & "\menuplus.lnk") FileCreateShortcut ($var, @WINDOWSDIR & "\windowmenu.lnk")The problem here is that the @ProgramFilesDir gets set to the C:\Program Files(x86)\ directory instead of where I have installed the program.What's curious about this is that I'm using @ProgramFilesDir to actually set the installation directory earlier in the script, and then it sets it to C:\Program Files\, as I want it to do.$var = @ProgramFilesDir & "\WindowsMenuPlus\" Send ($var)Any thoughts on why the @ProgramFilesDir gets a different value when it's used later in the script? Link to comment Share on other sites More sharing options...
JFX Posted September 7, 2010 Share Posted September 7, 2010 The idea behind is that 32 Bit applications are installed in Program Files(x86) and native ones in Program Files. If Not @AutoItX64 And @OSArch = 'x64' Then ConsoleWrite(EnvGet('ProgramW6432') & @crlf) Else ConsoleWrite(@ProgramFilesDir & @crlf) EndIf Link to comment Share on other sites More sharing options...
MNeMiC Posted September 7, 2010 Author Share Posted September 7, 2010 (edited) Thanks, that helped, it's still strange why it would do that though. Also, it didn't help that I wrote the file name incorrectly (WindowsMenuPlus instead of WindowMenuPlus) ;x64 Fix If Not @AutoItX64 And @OSArch = 'x64' Then $var = EnvGet('ProgramW6432') & "\WindowMenuPlus\WindowMenuPlus.exe" Else $var = @ProgramFilesDir & "\WindowMenuPlus\WindowMenuPlus.exe" EndIf ;Add a shortcut to autostart FileCreateShortcut ($var, @StartupDir & "\WindowMenuPlus.lnk") ;Add a shortcut to WINDOWS-directory for fast RUNning FileCreateShortcut ($var, @WINDOWSDIR & "\windowmenuplus.lnk") FileCreateShortcut ($var, @WINDOWSDIR & "\wmplus.lnk") FileCreateShortcut ($var, @WINDOWSDIR & "\menuplus.lnk") FileCreateShortcut ($var, @WINDOWSDIR & "\windowmenu.lnk") Edited September 7, 2010 by MNeMiC Link to comment Share on other sites More sharing options...
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