DOS Programs and NET USE¶
DOS and some Windows applications rely on device mapping techniques to talk to network fileshares and other services. A mapping associates a Windows host and device name with a local virtual hardware device specification using NET USE commands.
While the NET USE command includes a method of remembering mappings, Windows has a corresponding habit of forgetting mappings at inopportune times. Consequently script files should be created to execute mappings from desktop icons.
The following instructions are intended to work in both Windows XP and Windows 7. Testing was performed on Professional editions only.
Download links¶
Batch programs mentioned in this article may be downloaded from the following links:
Configure 32-bit Windows¶
Note
The configuration steps below will work for Windows XP and Windows 7
32-bit editions only. WARES cannot run natively on a 64-bit operating
system, and so the Windows virtual mode is required. In virtual mode, it is
not possible to call a desktop batch file with the %USERPROFILE%
syntax
as described in section WARES.BAT for Windows 7:.
Setup a NETPRINT.BAT icon:¶
Right-Click on the desktop, choose New ‣ Text document.
Change the filename to NETPRINT.BAT and press
<Enter>
.Right-Click on NETPRINT.BAT, choose Edit.
Enter printer mapping commands, for example:
NET USE LPT1 /DELETE NET USE LPT1 \\127.0.0.1\sharename IF NOT %ERRORLEVEL%==0 PAUSE
Press
<Alt-F>,<S>,<Alt-F>,<X>
to save and close.
WARES.BAT for Windows 7:¶
- Display a command window on the local windows workstation.
- Type
EDIT W:\WARES.BAT
, and press<Enter>
. - Press
<Down>,<Enter>,<Up>
to insert a blank second line. - Type
CALL "%USERPROFILE%\DESKTOP\NETPRINT.BAT"
. - Press
<Alt-F>,<S>,<Alt-F>,<X>
to save and exit the editor. - Type
EXIT
to close the command window.
Note
Fixing WARES.BAT
is a global change. Perform this step
exactly once, not once per workstation.
Copy WARES.pif to Desktop:¶
- Copy
W:\WARES.pif
to the local desktop. - Right-click the icon, and choose Properties.
- Click the Program tab.
- At the Cmd line: prompt, specify a unique user identifier.
(This entry should read,
W:\WARES.BAT USERxx
wherexx
is between 00 and 09.) - Click buttons Apply and OK.
64-bit Windows Virtual Mode¶
Programs running in Windows Virtual Mode cannot access the local user’s home
folder through the %USERPROFILE%
command syntax. Also, Windows has a nasty
habit of refusing to execute batch commands which exist in the user’s home
folder when the active directory of the command is on another device. These
issues can be addressed through the following two-part workarounds, which can
be applied to all versions of Windows.
Installing Virtual Mode¶
Use Microsoft’s guide to installing Windows Virtual PC and XP Mode to set up your Windows 7 Professional, Enterprise, or Ultimate edition with this free download feature.
Tip
Display the actual installation directions by clicking the blue Show all title text.
Copy Batch Programs to C:\¶
- Open Start ‣ (My) Computer on the desktop.
- Click on
Local Disk (C:\)
to display the files and folders there. - Make sure the Address bar shows
C:\
. - Drag
NETSHARE.BAT
andNETPRINT.BAT
from the desktop to an empty area of driveC:\
. - <Right-click> on
NETSHARE.BAT
, choose Create Shortcut from the menu. - <Right-click> on
NETPRINT.BAT
, choose Create Shortcut from the menu. - Drag the two new shortcut files from
C:\
back to the desktop. - Close the Computer window.
- On the desktop, <Right-click>
Shortcut to NETSHARE.BAT
and choose menu item Rename. Change the name toNETSHARE.BAT
. - On the desktop, <Right-click>
Shortcut to NETPRINT.BAT
and choose menu item Rename. Change the name toNETPRINT.BAT
.
Call Batch Programs on C:\¶
Windows may refuse to execute %USERPROFILE%\DESKTOP\NETPRINT.BAT
,
particularly if the program is called from Virtual Mode. In that case, relocate
the program to drive C:\
as described previously. Then call it from
there, as follows:
Display a command window on the local windows workstation.
Type
EDIT W:\WARES.BAT
, and press<Enter>
.Press
<Down>,<Enter>,<Up>
to insert a blank second line.Type in the following series of commands:
IF NOT EXIST "%USERPROFILE%\DESKTOP\NETPRINT.BAT" GOTO DRIVE_C CALL "%USERPROFILE%\DESKTOP\NETPRINT.BAT" GOTO ENDPRINT :DRIVE_C IF NOT EXIST %SYSTEMDRIVE%\NETPRINT.BAT GOTO ENDPRINT %SYSTEMDRIVE% CALL \NETPRINT.BAT IF $%2$==$$ W: %2 :ENDPRINT
Press
<Alt-F>,<S>,<Alt-F>,<X>
to save and exit the editor.Type
EXIT
to close the command window.
This revised WARES.BAT
may be
downloaded as mentioned above. The revised WARES.BAT and WARES.pif files
downloaded here are also intended to work with EMSmagic to provide EMS for Dell
and other computers with designed-in incompatibility.