| 1. |
Solve : Doing differant things depending on what version of OS? |
|
Answer» I'm trying to write a bat script that deals with the users "My DOCUMENTS" (to back it up). However, the path is differant in vista (just "Documents") then in XP ("My Documents"). So, i'm trying to write an if then STATEMENTS for weather this bat is being run on an XP MACHINE vs. a Vista machine. Any suggestions? and ver isn't a variable just prints the OS name and version number Isn't that what you're looking for? Armed with that information, you can construct the documents path. I don't know the results of the ver command on Vista, so we'll do this by the process of elimination: Code: [Select]@echo off for /f "tokens=3" %%x in ('ver') do ( if %%x==XP (set docpath=%userprofile%\My Documents) else (set docpath=%userprofile%\documents) ) The variable %docpath% will contain the correct value based on the OS. |
|