Troubleshooting
Problem
This document describes mapping a drive from a PC batch program and logging the output of the command, including errors and timestamps, to a log file.
Resolving The Problem
Drives and printers can be mapped using the Microsoft Windows NET USE command. This command is sometimes used to automate the mapping of network resources in batch programs. However, if errors occur, you may not see them before the batch program ends. The following batch program has been tested on Windows 7. It creates a log file and appends all drive mappings to that log, along with success or failure messages. The drive mapping messages are bracketed with timestamps. The steps below will redirect the NET USE command output that goes to the STDOUT and STDERR devices to the log file instead.
@echo Mapping drives.....
@echo off
echo %date:~4,6%%date:~12,2% %time:~0,8% Starting NET USE command to map drives >> "C:\Documents And Settings\All Users
\Documents\NETUSE.TXT"
NET USE X: \\SERVER\SHARE >> "C:\Documents And Settings\All Users\Documents\NETUSE.TXT" 2>&1
echo %date:~4,6%%date:~12,2% %time:~0,8% Completed NET USE command to map drives >> "C:\Users\Public\Documents\NETUSE.TXT"
echo ___________________________________________________________ >> "C:\Documents And Settings\All Users\Documents\NETUSE.TXT"
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CLSAA2","label":"Integrated File System-\u003ENetServer"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
340247837
Was this topic helpful?
Document Information
More support for:
IBM i
Component:
Integrated File System->NetServer
Software version:
All Versions
Operating system(s):
IBM i
Document number:
639097
Modified date:
23 October 2024
UID
nas8N1016072
Manage My Notification Subscriptions