JSI Tip 0939. Some 16bit apps must print to the device= in WIN.INI.

If you have one of the subject apps, and you have roaming users, you can alter %SystemRoot%\WIN.INI by using WININI.BAT.

WININI.BAT uses REG.EXE to extract the users default printer from

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device

It then copies WIN.INI to WINI.OLD, creates a WIN.NEW, replacing all occurences of device=, and finally copies WIN.NEW to WIN.INI. A large WIN.INI can take quite some time to process, so strip out any obsolete entries if you can.

To use WININI.BAT, simply call it in a batch job that starts the app or in the logon script:

call winini

WININI.BAT contains:

@echo off
for /f "Tokens=*" %%i in ('reg -Quiet -ListValue "\HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"') do set regprt=%%i
REM The above FOR statement is one line.
set regprt=%regprt:REG_SZ =%
copy %SystemRoot%\Win.ini %SystemRoot%\win.old
if exist %SystemRoot%\Win.new del /q %SystemRoot%\Win.new
FOR /F "Tokens=1* Delims

" %%i in (%SystemRoot%\Win.ini) do call :winini "%%i" "%%j"
set b1=
set p1=
set p2=
set regprt=
goto end
set p1=!%1!
set p2=!%2!
set p1=%p1:!"=%
set p1=%p1:"!=%
set p2=%p2:!"=%
set p2=%p2:"!=%
set b1=%p1:~0,1%
if "%b1%"

"\[" goto bracket
if "%p1%"

"" goto end
if "%p1%"

"device" goto prt
@echo %p1%=%p2% >> %SystemRoot%\Win.new
goto end
@echo %p1% >> %SystemRoot%\Win.new
goto end
@echo device=%regprt% >> %SystemRoot%\Win.new
goto end
del /q %SystemRoot%\Win.ini
copy %SystemRoot%\Win.new %SystemRoot%\Win.ini

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.