General discussion

Locked

Net Use in Batch file for Windows 98

By MissyC ·
If I run 'net use x: \\servername\sharename from a command line in Windows 98 it maps the drive perfectly. If I add this statement to a batch file it does nothing. Why is this not working in the batch file but working when I type it 'verbatim' at the command line?

Thanks!

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Comments

Collapse -

Net Use in Batch file for Windows 98

by Joseph Moore In reply to Net Use in Batch file for ...

The BAT file is probably running under a System account status. So, when the credentials are passed from your Win9x machine to the server with the shared folder, instead of your user name that you logged in with, the System credential is being presented to map the drive. And the System account on your Win9x machine does not have rigths to the shared folder.
So, add the /U: switch to the NET USE command to specify a user name and password.
For example, if the username BOB has rights on the share, and BOB has a password of "password", the NET USE line would look like this:

NET USE X: \\SERVERNAME\SHARENAME /U:BOB password

Try that in the BAT file.

hope this helps

Collapse -

Net Use in Batch file for Windows 98

by MissyC In reply to Net Use in Batch file for ...

Thanks for the response but it isn't a permissions issue. First, I have appropriate permissions. Second, the command string I use works perfectly at the dos prompt, but dies in a batch file.

Collapse -

Net Use in Batch file for Windows 98

by ctmoore1998 In reply to Net Use in Batch file for ...

NOTE that the system logon uses the 'x' drive designater so it is recommended that you don't map drives to this drive letter.
I assume that you run the batch file also from the command prompt and don't see any errors listed. Try a batch file such as this one and run from the command line.. name the file mapdrv.bat
NET USE G: /d /y
PAUSE
NET USE G: \\servername\sharename
PAUSE
EXIT
IF either the servername or sharename is greater than 8 chars enclose in quotes. Check at each pause forany error msgs. If you have used the wild card to delete drive mappings ( NET USE * /D /Y ) then check to see if the user profile has assigned a letter to a home directory. Then do a NET USE ? /home to recreate the home from a command prompt then rerun the script if it works now then don't use the wild card to delete drive mappings. create a net use ? /d /y for each required drive and the script should run fine. I have found this to be a issue with workstations if the home path gets deleted at the beginning of a script with the NET USE * /d /y at the beginning. You may even have to remove the home directory path from the profile to get the script working properly.

Collapse -

Net Use in Batch file for Windows 98

by MissyC In reply to Net Use in Batch file for ...

Obviously I wasn't using 'X', it was a the generic letter I used when describing this issue. I think I've narrowed it down to my if then statement that proceeds the net use command.

Collapse -

Net Use in Batch file for Windows 98

by MissyC In reply to Net Use in Batch file for ...

This question was closed by the author

Back to Windows Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums