Link to home
Start Free TrialLog in
Avatar of TacomaVA
TacomaVA

asked on

Batch Script - Map Network Drive

Hello,

I have a batch script that among other things, maps a network drive using syntax similar to this:

Net use Z: \\192.168.200.10\dog$ /USER:dog-pc\cat C9d!42$%

When I execute the script, I get a "logon failure unknown username or password" error.

When I type the syntax (exactly the same as the batch script) into a command prompt, the command executes successfully and the shared folder is mapped.

What am I doing incorrectly that is preventing the batch script from working successfully?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
To add to that.... the ! shouldn't be an issue unless you have setlocal  enabledelayedexpansion used in the batch.  If so I don't know a way that you can use ! but if not using the above then just doubling the % to %% should do it.

Steve
Glad it helped.

Steve