www.rodneybeede.com "I would love to change the world, but they won't give me the source code" - unknown
  Navigation

Linux System Rescue CD batch script to install from Windows - Last Modified 2009-10-30 20:52 UTC - Created 2009-10-30 20:52 UTC

System Rescue CD forum topic on a useful Windows batch script for extracting the iso to a usb key.

If you can't find it there here it is as well.

@ECHO OFF
SETLOCAL 

REM   Author:  Rodney Beede  
REM   First Version:  2009-01-31 
REM   License:  Public Domain 

REM   For System Rescue CD 1.1.4 and later


REM   You may need to change ISO_EXTRACT_PROGRAM and ISO_EXTRACT_PROGRAM_OPTS to 
REM   match any different programs you wish to use 
REM   They are set below at the ***** CHANGEABLE OPTIONS ***** section 



ECHO This script allows you to extract the contents of the System Rescue CD ISO 
ECHO onto a disk drive of your choice. 
ECHO. 
ECHO You must run this script as an Administrator 
ECHO. 
ECHO The ISO should be located in the same directory as this script 
ECHO. 
ECHO The usb drive must already have a FAT or FAT32 filesystem 
ECHO. 
ECHO Tested to work with Windows XP SP2+ and Windows Vista SP1+ with version 
ECHO   1.1.4 of System Rescue CD 
ECHO. 
ECHO. 


SET /P TARGET_DRIVE=Enter in the drive letter of the usb key:  


IF "" EQU "%TARGET_DRIVE%" ( 
   ECHO You MUST enter a drive letter 
   EXIT /B 
   ) 



REM   ***** CHANGEABLE OPTIONS ***** 

REM   What program to run to extract files from the ISO (no "") 
SET ISO_EXTRACT_PROGRAM=C:\Program Files\7-Zip\7z.exe 

REM   Options to append after the ISO_EXTRACT_PROGRAM command 
SET ISO_EXTRACT_PROGRAM_OPTS=x -o%TARGET_DRIVE%:\ -r 

REM   ***** END CHANGEABLE OPTIONS ***** 



REM   Determine the ISO to use 
FOR %%i IN (%~dp0systemrescuecd-*.iso) DO SET ISO_FILE=%%i 

IF "" EQU "%ISO_FILE%" ( 
   ECHO Could not find ISO in %~dp0 
   EXIT /B 
) ELSE ( 
   ECHO Using %ISO_FILE% 
   ECHO. 
) 


REM   Extract the entire ISO contents
"%ISO_EXTRACT_PROGRAM%" %ISO_EXTRACT_PROGRAM_OPTS% "%ISO_FILE%" * 



REM   Prepare SysLinux 
FOR %%i IN (%TARGET_DRIVE%:\bootprog\syslinux-*.zip) DO SET SYSLINUX_ZIP=%%i 

"%ISO_EXTRACT_PROGRAM%" %ISO_EXTRACT_PROGRAM_OPTS% "%SYSLINUX_ZIP%" win32\syslinux.exe 

MOVE %TARGET_DRIVE%:\win32\syslinux.exe %TARGET_DRIVE%:\syslinux.exe 

RMDIR /S /Q %TARGET_DRIVE%:\win32 



REM   Move the SysLinux items into place 

MOVE %TARGET_DRIVE%:\isolinux\isolinux.cfg %TARGET_DRIVE%:\isolinux\syslinux.cfg 

MOVE %TARGET_DRIVE%:\isolinux %TARGET_DRIVE%:\syslinux 



REM   Make usb drive bootable (writes mbr) 

%TARGET_DRIVE%:\syslinux.exe -maf %TARGET_DRIVE%: 


ECHO ALL DONE