July 31, 200818 yr Hi guysI'm have succeeded in automatically installing printers with WPI, by using vbscript.I also want to configure default options (Duplex feature) on some printers.And finally, I want newly created user account to already have a preference to print duplex on those.To do this last step, I needed to run multiple REG IMPORT commands, so I created a batchfile:REG IMPORT "%WPIPATH%\Install\Printer Scripts\PrintersConfig.reg"REG IMPORT "%WPIPATH%\Install\Printer Scripts\UserPrefs_HKCU.reg"REG LOAD HKEY_USERS\Default_User "C:\Documents and Settings\Default User\ntuser.dat"REG IMPORT "%WPIPATH%\Install\Printer Scripts\UserPrefs_Default_User.reg"REG UNLOAD HKEY_USERS\Default_UserThis batchfile itself is run from WPI as:"%wpipath%\Install\Printer scripts\CustomConfig.bat"However, the %wpipath% variable is not available in my batch file...I solved it by calling it with wpipath as first argument:"%wpipath%\Install\Printer scripts\CustomConfig.bat" %wpipath%and then using %1 in my batch file:REG IMPORT "%1\Install\Printer Scripts\PrintersConfig.reg"REG IMPORT "%1\Install\Printer Scripts\UserPrefs_HKCU.reg"REG LOAD HKEY_USERS\Default_User "C:\Documents and Settings\Default User\ntuser.dat"REG IMPORT "%1\Install\Printer Scripts\UserPrefs_Default_User.reg"REG UNLOAD HKEY_USERS\Default_UserThis works fine but I wonder if it is the Right Way...
July 31, 200818 yr I think the way you've done it is perfectly fine.Another alternative, assuming you're doing an unattended Windows install, would be to put your .reg files somewhere in the <Your CD>\$OEM$\$1\ directory structure. So for example, you could just copy your folder "Printer Scripts" into the $1 directory. This will cause "Printer Scripts" to be copied to the system drive (usually C drive) when Windows is installed, allowing you to reference your .reg files as follows: "%SYSTEMDRIVE%\Printer Scripts\<whatever>.reg".Please note that you must set "OemPreinstall=Yes" in your WINNT.SIF for the contents of <Your CD>\$OEM$\$1\ to be copied to the system drive.More information:WINNT.SIF Reference$OEM$ Distribution Folders
August 17, 200818 yr On WPI-Start I create SetWPIEnv.cmd on %SystemDrive% which sets some variables:createSetWPIEnv.cmd@ECHO OFFSET CMD=%SYSTEMDRIVE%\SetWPIEnv.cmdSET HIDEWINDOW=noSET DISABLE_CLEANUP=noSET DISABLE_INSTALL=yes:PARSE IF /I "%~1"=="-h" SET HIDEWINDOW=yes IF /I "%~1"=="-c" SET DISABLE_CLEANUP=no IF /I "%~1"=="-dc" SET DISABLE_CLEANUP=yes IF /I "%~1"=="-i" SET DISABLE_INSTALL=no IF /I "%~1"=="-di" SET DISABLE_INSTALL=yes SHIFT IF NOT "%~1"=="" GOTO :PARSECALL :OUTPUT>"%CMD%"GOTO :EOF:OUTPUT SET TMP=%~dp0 SET TMP=%TMP:~0,-7% ECHO @ECHO OFF ECHO. ECHO.SET HIDEWINDOW=%HIDEWINDOW% ECHO.SET DISABLE_CLEANUP=%DISABLE_CLEANUP% ECHO.SET DISABLE_INSTALL=%DISABLE_INSTALL% ECHO. ECHO SET ROOT=%TMP% ECHO SET WPIPATH=%TMP%\WPI ECHO SET CDROM=%~d0 ECHO SET PATH=%%PATH%%;%TMP%\Tools ECHO. ECHO IF /I "%%HIDEWINDOW%%"=="yes" IF EXIST "%%ROOT%%\Tools\cmdow.exe" "%%ROOT%%\Tools\cmdow.exe" @ /HID ECHO. GOTO :EOFwhich will create a batch like thisSetWPIEnv.cmd@ECHO OFFSET HIDEWINDOW=noSET DISABLE_CLEANUP=noSET DISABLE_INSTALL=yesSET ROOT=D:\SystemSET WPIPATH=D:\System\WPISET CDROM=D:SET PATH=%PATH%;D:\System\ToolsIF /I "%HIDEWINDOW%"=="yes" IF EXIST "%ROOT%\Tools\cmdow.exe" "%ROOT%\Tools\cmdow.exe" @ /HIDEach Batch-File checks if that file exists an runs it - so I have access to all Tools, Paths and so on.
Create an account or sign in to comment