Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cygwin's bash can't run 'net use /user' command?

I run 'net use /user:"Someone" \somewhere', and it works well with cmd.exe.

With the same cmd.exe, run 'bash --login -i' to use the cygwin/bash, and run the same command but I get the error message as follows.

System error 67 has occurred.

The network name cannot be found.

Why can't I run 'net use /user' command with cygwin/bash?

like image 457
prosseek Avatar asked Dec 06 '22 03:12

prosseek


2 Answers

In cygwin's bash, you need to escape any of those forwardback slashes, as those are interpreted as escape characters.

try this

net use /user:"Someone" \\\\server\\share

or use single quotes, which will pass the argument unchanged

net use /user:"Someone" '\\server\share'

like image 166
karoberts Avatar answered Dec 11 '22 10:12

karoberts


I have ran into problems attempting to use the /delete switch with net use from bash in windows. It seems to be something with the way certain windows commands process command line arguments.

I thought I could get around it by launching "net use" from a cmd.exe sub shell, but that too appears to be impacted by the argument processing problem. I found a work around for cmd.exe in quoting but could not seem to find the right quoting to use net use directly for the task.

$ cmd "/c net use T: /delete"
like image 43
Jason Pierce Avatar answered Dec 11 '22 10:12

Jason Pierce