gai-jin Posted August 23, 2004 Share Posted August 23, 2004 I'd like to keep track of every ISO I make of my restore disk. To keep version numbers, and easily identify the different versions. What do I need to do to make the batch listed below call the old version number (from a text file, likely), add 1 to the number, store this to memory as a variable, and write the new version number over the old in the text file, then use the version number variable in the iso file name?This way, if I have multiple revisions of the iso saved, it's easy to tell just what 'version' is most recent/experimental.Thanks,Gai-jinCLS@echo offTITLE Creating ISO Image of Windows XP ProfessionalECHO.ECHO Removing any possible attributes set on C:\Workshop\Restore CDs\CD Set\CD1 and its subfolders...attrib -R -H C:\Workshop\restor~1\2.0\CDSET~1\CD1 /S /DECHO. ECHO Creating ISO...CDIMAGE.EXE -lXPdisc1 -t12/31/2002,12:00:00 -h -j1 -m -bxpboot.img C:\Workshop\restor~1\2.0\CDSET~1\CD1 C:\Workshop\restor~1\2.0\XPSp2R1.ISOECHO.ECHO.ECHO Removing any possible attributes set on C:\Workshop\Restore CDs\CD Set\CD2 and its subfolders...attrib -R -H C:\Workshop\restor~1\2.0\CDSET~1\CD2 /S /DECHO. ECHO Creating ISO...CDIMAGE.EXE -lXPdisc2 -t12/31/2002,12:00:00 -h -j1 -m -bxpboot.img C:\Workshop\restor~1\2.0\CDSET~1\CD2 C:\Workshop\restor~1\2.0\XPSp2R2.ISOECHO.PAUSEEXIT Link to comment Share on other sites More sharing options...
gai-jin Posted August 24, 2004 Author Share Posted August 24, 2004 bump Link to comment Share on other sites More sharing options...
johann83 Posted August 24, 2004 Share Posted August 24, 2004 Heres a batch file that does something like what you are trying to do. It looks at a three digit number in a text file (file path/name specified in batch) and increments it and then writes it back out to the file. In the mean time the old and new values are stored in two variables which could be used elsewhere in the script (e.g. in your CDIMAGE commands). I hope this helps you.@ECHO OFFCLSSETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION:: Define the name of the file containing the version numberSET VERFILE=VER.TXT:: Make sure the version file existsIF NOT EXIST %VERFILE% GOTO ERROR:: Check current version (from file)FOR /F "delims=" %%F IN (%VERFILE%) DO SET CURRVER=%%F:: Increment the version numberIF "%CURRVER%" LSS "009" ( SET /A TMP1=%CURRVER:~-1%+1 SET NEWVER=%CURRVER:~0,-1%!TMP1!) ELSE IF "%CURRVER%" EQU "009" ( SET /A TMP1=%CURRVER:~-1%+1 SET NEWVER=%CURRVER:~0,-2%!TMP1!) ELSE ( SET /A TMP1=%CURRVER:~-2%+1 SET NEWVER=%CURRVER:~0,-2%!TMP1!):: Write the new version number to a temporary fileECHO %NEWVER%>>%VERFILE:~0,-4%.TMP:: Update the version file with the temporary oneXCOPY /Q /Y %VERFILE:~0,-4%.TMP %VERFILE% >> NULDEL %VERFILE:~0,-4%.TMP >> NUL:: Done, exit the scriptGOTO END:ERRORECHO An unexpected error occured during this operation.:ENDECHO.PAUSEEXITRegards,Matt Link to comment Share on other sites More sharing options...
gai-jin Posted August 25, 2004 Author Share Posted August 25, 2004 Exactly what I was looking for. Thanks! Link to comment Share on other sites More sharing options...
lloydspnm Posted August 25, 2004 Share Posted August 25, 2004 I use VB to update a marker file in the root of the C:\ drive. An example file is called Build-xp.01.01.000 and the 000 will go to 001' Rename the build marker fileOPTION EXPLICITDim fsoDim Folder, OldFile,NewFile, FileCollDim MajorMinorDim BuildNumberDim FolderPathSet fso = CreateObject("Scripting.FileSystemObject")wscript.echo "Finding Marker file"FolderPath = "..\XP With SP1\$OEM$\$1"Set Folder = fso.GetFolder(FolderPath)Set FileColl = Folder.FilesFor Each OldFile in FileColl If Left(OldFile.name,8)="Build-XP" Then WScript.echo "Old Marker " & OldFile.Name MajorMinor = Left(OldFile.name,14) BuildNumber = Right(OldFile.Name,3) BuildNumber = BuildNumber + 1 NewFile = MajorMinor & "." & Right("000" & BuildNumber,3) WScript.Echo "Renaming to " & NewFile fso.MoveFile FolderPath & "\" & OldFile.Name, FolderPath & "\" & NewFile Exit For End IfNextSet fso=Nothingwscript.echo "Finished"This gets called as part of the ISO Creation command file using:ECHO Updating Build NumberCSCRIPT RENAME.VBSECHO Creating ISO... 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