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.

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:

  1. Right-Click on the desktop, choose New ‣ Text document.

  2. Change the filename to NETPRINT.BAT and press <Enter>.

  3. Right-Click on NETPRINT.BAT, choose Edit.

  4. Enter printer mapping commands, for example:

    NET USE LPT1 /DELETE
    NET USE LPT1 \\127.0.0.1\sharename
    IF NOT %ERRORLEVEL%==0 PAUSE
    
  5. Press <Alt-F>,<S>,<Alt-F>,<X> to save and close.

Setup a NETSHARE.BAT icon:

  1. Right-Click on the desktop, choose New ‣ Text document.

  2. Change the filename to NETSHARE.BAT and press <Enter>.

  3. Right-Click on NETSHARE.BAT, choose Edit.

  4. Enter share mapping commands, for example:

    NET USE W: /DELETE
    NET USE W: \\AAltSysServer\wares
    IF %ERRORLEVEL% NEQ 0 PAUSE
    NET USE S: /DELETE
    NET USE S: \\AAltSysServer\shared
    IF %ERRORLEVEL% NEQ 0 PAUSE
    
  5. Press <Alt-F>,<S>,<Alt-F>,<X> to save and close.

WARES.BAT for Windows 7:

  1. Display a command window on the local windows workstation.
  2. Type EDIT W:\WARES.BAT, and press <Enter>.
  3. Press <Down>,<Enter>,<Up> to insert a blank second line.
  4. Type CALL "%USERPROFILE%\DESKTOP\NETPRINT.BAT".
  5. Press <Alt-F>,<S>,<Alt-F>,<X> to save and exit the editor.
  6. 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:

  1. Copy W:\WARES.pif to the local desktop.
  2. Right-click the icon, and choose Properties.
  3. Click the Program tab.
  4. At the Cmd line: prompt, specify a unique user identifier. (This entry should read, W:\WARES.BAT USERxx where xx is between 00 and 09.)
  5. 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:\

  1. Open Start ‣ (My) Computer on the desktop.
  2. Click on Local Disk (C:\) to display the files and folders there.
  3. Make sure the Address bar shows C:\.
  4. Drag NETSHARE.BAT and NETPRINT.BAT from the desktop to an empty area of drive C:\.
  5. <Right-click> on NETSHARE.BAT, choose Create Shortcut from the menu.
  6. <Right-click> on NETPRINT.BAT, choose Create Shortcut from the menu.
  7. Drag the two new shortcut files from C:\ back to the desktop.
  8. Close the Computer window.
  9. On the desktop, <Right-click> Shortcut to NETSHARE.BAT and choose menu item Rename. Change the name to NETSHARE.BAT.
  10. On the desktop, <Right-click> Shortcut to NETPRINT.BAT and choose menu item Rename. Change the name to NETPRINT.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:

  1. Display a command window on the local windows workstation.

  2. Type EDIT W:\WARES.BAT, and press <Enter>.

  3. Press <Down>,<Enter>,<Up> to insert a blank second line.

  4. 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
    
  5. Press <Alt-F>,<S>,<Alt-F>,<X> to save and exit the editor.

  6. 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.