Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Batch file to map a drive when the folder name contains spaces

Tags:

batch-file

I am trying to map a drive using a batch file. I have tried:

net use m: \\Server01\myfolder /USER:mynetwork\Administrator "Mypassword" /persistent:yes

It works fine. The problem comes when I try to map a folder with spaces on its name:

net use m: \\Server01\my folder /USER:mynetwork\Administrator "Mypassword" /persistent:yes

I have tried using quotes, using myfold~1 but nothing works.

An easy way would be renaming the folder but I have it mapped in more than 300 workstations so is not a very good idea.

like image 889
Santiago Avatar asked Apr 12 '10 06:04

Santiago


1 Answers

I just created some directories, shared them and mapped using:

net use y: "\\mycomputername\folder with spaces"

So this solution gets "works on my machine" certificate. What error code do you get?

like image 157
chalup Avatar answered Oct 11 '22 00:10

chalup