A1. Most functions of RMPrepUSB are available in RMPartUSB and so can be scripted - except you will need to use XCOPY to copy files to the USB drive once it has been formatted. Some special commands and code examples are shown below (code in bold, keywords in red bold): RMPARTUSB LIST RMPARTUSB v2.1.600 (c)2008-10 RM Education plc [SSi] ==================================================== *DRIVE 1 - 7.5GiB TakeMS MEM-Drive Smart USB Devi Fw=0.00 H: DRIVE 2 - 7.5GiB Verbatim STORE N GO USB Device Fw=5.00 J: RMPARTUSB LIST ALLDRIVES RMPARTUSB v2.1.600 (c)2008-10 RM Education plc [SSi] ==================================================== *DRIVE 0 - 232.8GiB ST3250820AS ATA Device Fw=3.ADG Sno=202020202020202 C: DRIVE 1 - 7.5GiB TakeMS MEM-Drive Smart USB Devi Fw=0.00 H: DRIVE 2 - 7.5GiB Verbatim STORE N GO USB Device Fw=5.00 J: RMPARTUSB FIND > drv.cmd example drv.cmd file produced is: SET DRIVE=1 SET DRIVEDESC=TakeMS MEM-Drive Smart USB Device SET DRIVESIZE=8086618112 SET DRIVELETTER=H: SET DRIVE1DESC=TakeMS MEM-Drive Smart USB Device SET DRIVE1SIZE=8086618112 SET DRIVE1LETTER=H: SET DRIVE2DESC=Verbatim STORE N GO USB Device SET DRIVE2SIZE=8011120640 SET DRIVE2LETTER=J: (Note: DRIVE, DRIVEDESC and DRIVELETTER are used for the FIRST USB DRIVE to be found, if more than one USB drive is expected to be in the system then use the DRIVEn variables). Example of how to use in a batch file: RMPartUSB FIND > drv.cmd call drv.cmd del drv.cmd echo Drive 1 is a %DRIVE1DESC% with a size of %DRIVE1SIZE% and a volume letter of %DRIVE1LETTER% FOR /F "tokens=*" %%A IN ('RMPartUSB FIND') DO %%A echo Drive 1 is a %DRIVE1DESC% with a size of %DRIVE1SIZE% and a volume letter of %DRIVE1LETTER% Another example - ask user to select a USB drive and copy files to it: RMPARTUSB LIST set /P DD=Please enter the USB Flash drive number you want to use: rmpartusb DRIVE=%dd% WINPE FAT32 2PTN VOLUME=WINPE if errorlevel 1 echo COMMAND FAILED! if errorlevel 1 goto :EOF rmpartusb DRIVE=%dd% GETDRV > drv1.cmd set USBDRIVELETTER= call drv1.cmd del drv1.cmd If "%USBDRIVELETTER%"="" goto :EOF xcopy /herky C:\mysourcefiles\*.* %USBDRIVELETTER%\*.* echo all files copied! example drv1.cmd file produced is: SET USBDRIVE=1 SET USBDRIVEDESC=TakeMS MEM-Drive Smart USB Device SET USBDRIVESIZE=8086618112 SET USBDRIVELETTER=H: Another example - ask user to select the USB drive, partition and format the drive, add grub4dos and copy files to it: @echo off REM change to our working folder pushd "C:\Program Files (x86)\RMPrepUSB" REM list all USB drives so user can see them and their drive number RMPARTUSB LIST REM Ask user for a drive number set /P DD=Please enter the USB Flash drive number you want to use: REM execute RMPARTUSB (insert SURE if you don't want the user prompt) RMPARTUSB DRIVE=%dd% MSDOS FAT32 2PTN FORCELBA VOLUME=WINPE if errorlevel 1 echo RMPARTUSB COMMAND FAILED! if errorlevel 1 goto :EOF set USBDRIVELETTER= REM get the drive letter of the newly formatted drive FOR /F "tokens=*" %%A IN ('RMPARTUSB DRIVE^=%dd% GETDRV') DO %%A If "%USBDRIVELETTER%"=="" goto :EOF REM install grub4dos grubinst -v --skip-mbr-test (hd%dd%) If errorlevel 1 goto :EOF REM use touchdrv to ensure MBR changes are not removed by Windows! touchdrv %USBDRIVELETTER% REM copy grldr file over which is needed by grub4dos copy grldr %USBDRIVELETTER% If errorlevel 1 goto :EOF REM copy over boot files (assumes a menu.lst file has been added for use by grub4dos) xcopy /herky .\mybootfiles\*.* %USBDRIVELETTER%\*.* If errorlevel 1 goto :EOF echo Finished - All files copied! Q2 How can I determine the correct command for RMPartUSB? Use RMPrepUSB, set your options and click the Prepare Drive button and note down the command line that it uses to call RMPartUSB (uncheck 'No user prompts' checkbox). Otherwise typing RMPARTUSB on the command line should give some help. |