How to mount a SMB share that contains spaces in the name??

Hi Everyone-

Does anyone know how to connect to a microsoft share using smb if the share name has a space in it?

For example:


smb://SERVER;username:password@computer/SHARE NAME"

This does not work. Yet when I use the finder to connect to the share, the share name pops up as a choice to select and I can connect that way. Therefore, the finder recognizes a share name this way, but I can’t get my applescript to recognize it and connect.

Any ideas?

Thanks.
SA

Try escaping the space with a backslash…

smb://SERVER;username:password@computer/SHARE NAME"

Tried that.

Seems applescript does not like that and the script editor gives an error when I try to check the syntax.

%20 does not work either.

Any other ideas?

Thanks.
SA :smiley:

Sorry 'bout that…

mount volume "smb://SERVER;username:password@computer/SHARE\ NAME"

It needs two backslashes – untested, I do not use smb…
It might error because of the word “SERVER;” too.

Nope.

That gives me the same error.

SERVER should not matter because I use that in other scripts and they work fine if the share name is one word.

Any other ideas?

Thanks.
SA

What is the error you are getting? Is it a syntax error, or is it something else? Have you tried using the other machines IP address instead of the “computer” name?

Here is the error I get:


Finder got an error: File some object wasn't found

This error comes when I try to run the following script:



set folder_ to "Folder Name"
set volume_ to "smb://NETBIOSNAME;username:pass@Computer/SHARE\ NAME"

tell application "Finder"
	--try
	mount volume volume_
	--end try
	open alias folder_
end tell


When I get the error, script editor highlights the following portion of the script:



	mount volume volume_


This same code works for shares that are one word, but the space throws off applescript for some reason. I was going to try the same thing from the command line, but I’m not sure what that command would be.

Any ideas?

Thanks.
SA :smiley:

I’m just guessing, and since I don’t use smb I have no way of testing it, you might give this a try…

set volume_ to "smb://NETBIOSNAME;username:pass@Computer/"SHARE NAME""

Also, I’m not sure if it’s any help, but the entire “Using Samba” book by OReilly is on your hard drive…

file:///usr/share/swat/using_samba/index.html