Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Access %WPIPATH% from within batch files

Featured Replies

Hi guys

I'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_User

This 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_User

This works fine but I wonder if it is the Right Way...

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

  • 3 weeks later...

On WPI-Start I create SetWPIEnv.cmd on %SystemDrive% which sets some variables:

createSetWPIEnv.cmd

@ECHO OFF
SET CMD=%SYSTEMDRIVE%\SetWPIEnv.cmd

SET HIDEWINDOW=no
SET DISABLE_CLEANUP=no
SET 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 :PARSE

CALL :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 :EOF

which will create a batch like this

SetWPIEnv.cmd

@ECHO OFF

SET HIDEWINDOW=no
SET DISABLE_CLEANUP=no
SET DISABLE_INSTALL=yes

SET ROOT=D:\System
SET WPIPATH=D:\System\WPI
SET CDROM=D:
SET PATH=%PATH%;D:\System\Tools

IF /I "%HIDEWINDOW%"=="yes" IF EXIST "%ROOT%\Tools\cmdow.exe" "%ROOT%\Tools\cmdow.exe" @ /HID

Each 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

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.