CWD Posted November 2, 2007 Share Posted November 2, 2007 I have a batch file for a simple software installation. The only way I have found to create a desktop shortcut as part of the installation is with a nifty utility called Shortcut.exe found here for free:http://www.optimumx.com/download/#ShortcutProblem is, there is a different Shortcut.exe for each version of Windows, which I have downloaded and renamed them like shortcut_XP.exe, shortcut_2000.exe etc.I am running on XP Pro and it works great with the shortcut_XP.exe, but I will need a way to direct the action to the correct version of the shortcut.exe by detecting the basic windows os being used.I can use VER to get the os version, but then that includes some very specific version info as well in the string. I cannot find a way of parsing the string and extracting just the "XP" to use in a variable. Is something like this even possible in a batch file?If not, any suggestions as to how to approach this differently? Link to comment Share on other sites More sharing options...
severach Posted November 2, 2007 Share Posted November 2, 2007 My approach would be to download Pelles-C and create a Win32 console project that sets the errorlevel based on the installed OS. Link to comment Share on other sites More sharing options...
Glenn9999 Posted November 2, 2007 Share Posted November 2, 2007 I went to the site you posted and don't find that the web site is offering me anything different based on what I select in the drop-down box. You might consider just doing one batch file and one EXE file. Link to comment Share on other sites More sharing options...
cluberti Posted November 2, 2007 Share Posted November 2, 2007 From a batch file.From a VBScript.What you do with these is up to you . Link to comment Share on other sites More sharing options...
gunsmokingman Posted November 2, 2007 Share Posted November 2, 2007 Here read this thread there are a couple of different examples of scripting what you want.Thread Link to comment Share on other sites More sharing options...
Mijzelf Posted November 2, 2007 Share Posted November 2, 2007 (edited) ECHO OFFVER | FIND "XP" >NULIF ERRORLEVEL == 1 GOTO NOTXPXP.exeGOTO END:NOTXPVER | FIND "2000" >NULIF ERRORLEVEL == 1 GOTO NOT20002000.exeGOTO END:NOT2000VER | FIND "98" >NULIF ERRORLEVEL == 1 GOTO NOT9898.exeGOTO END:NOT98...:ENDProbably you'll have to retype the pipes (|), since phpBB is doing something strange with them. Edited November 2, 2007 by Mijzelf Link to comment Share on other sites More sharing options...
os2fan2 Posted November 4, 2007 Share Posted November 4, 2007 It's more to do with the dodgy interface at Optimum X. The drop-down list is not really a selector at all, but just a way of hiding information. All of the downloads point to the same file. You don't really need to do anything more than look for the presence of explorer.exe for this program. Windows NT 3.x does not always have this file. Link to comment Share on other sites More sharing options...
Siginet Posted November 4, 2007 Share Posted November 4, 2007 Autoit can do this very simply.The Built in Macros: @OSVersion Returns one of the following: "WIN_VISTA", "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95"@OSType Returns "WIN32_NT" for NT/2000/XP/2003/Vista and returns "WIN32_WINDOWS" for 95/98/Me@OSBuild Returns the OS build number. For example, Windows 2003 Server returns 3790@OSServicePack Service pack info in the form of "Service Pack 3" or, for Windows 95, it may return "B" Link to comment Share on other sites More sharing options...
Yzöwl Posted November 4, 2007 Share Posted November 4, 2007 You can create shortcuts using the built in windows tools, VBScript (.vbs) and Setup Information Files (.inf) both of which were available in different versions of Windows. The methods used to do so are available in several locations throughout these forums.Autoit can do this very simply.The Built in Macros: @OSVersion Returns one of the following: "WIN_VISTA", "WIN_2003", "WIN_XP", "WIN_2000", "WIN_NT4", "WIN_ME", "WIN_98", "WIN_95"@OSType Returns "WIN32_NT" for NT/2000/XP/2003/Vista and returns "WIN32_WINDOWS" for 95/98/Me@OSBuild Returns the OS build number. For example, Windows 2003 Server returns 3790@OSServicePack Service pack info in the form of "Service Pack 3" or, for Windows 95, it may return "B"Then again, if you were going to do this you'd probably be able to ignore all that and just use FileCreateShortcut in AutoIt instead 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