# 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
###### Who is Participating?

IT ConsultancyCommented:
The ! And % signs have special meaning in batch files for expanding variables, e.g. echo %computername% so either change the password to not include them, or try one of these - been a long day and taking a breather from Xmas stuff to flick through emails so haven't double checked
C9d!!etc.%%
or
C9d!etching %%
Will look back another day if not and noone else helpsfor before.

Steve
0

IT ConsultancyCommented:
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
0

IT ConsultancyCommented:

Steve
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.