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

Install Linux System Rescue CD to USB drive using Windows batch script - Last Modified 2010-04-23 14:52 UTC - Created 2010-04-23 14:52 UTC

The original version can be found at System Rescue CD forum topic.

An updated version for System Rescue CD version 1.5.2 and later is below:

@ECHO OFF
SETLOCAL ENABLEEXTENSIONS

REM   Author:  Rodney Beede  
REM   Version:  2010-04-23
REM   License:  Public Domain 

ECHO For System Rescue CD 1.5.2 and later
ECHO.


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. 


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 (systemrescuecd-*.iso) DO SET ISO_FILE=%%~fI 

IF "" EQU "%ISO_FILE%" ( 
   ECHO Could not find ISO in %~dp0 
   EXIT /B 
) ELSE ( 
   ECHO.
   ECHO Using ISO found at %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