General discussion

Locked

net use not working

By adelhier ·
I am makeing a simple batch file to auto mount some files for a lab i work at. The students have a hard time finding there files. This is what i got so fare.

I set this

set classname=Drafting 51a 180

so i can just edit one part for each class then did this

net use * \\Mfgcadserv\student files\templets\%classname%

but i get this error

The syntax of this command is:


NET USE
[devicename | *] [\\computername\sharename[\volume] [password | *]]
[/USER:[domainname\]username]
[/USER:[dotted domain name\]username]
[/USER:[username@dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT:{YES | NO}]]

NET USE {devicename | *} [password | *] /HOME

NET USE [/PERSISTENT:{YES | NO}]


any help would be great.

Thanks,

Andy

This conversation is currently closed to new comments.

8 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by voldar In reply to net use not working

Check with > net help use < command, and you'll see what's the problem. There is no share name called %classname%. I may be wrong, never tried using net use this way, but ...

Collapse -

by voldar In reply to

When I say "share", I mean that, to "map" a folder, you have first to !share! that folder. And I don't think that "net use" command runs with the generic %classname% option.

Collapse -

by adelhier In reply to

%classname% is a variable in a bat file i set. It works fine i had problems with "".

Collapse -

by malkeetdxb In reply to net use not working

net use command is only used to map the
network drives from dos prompt not
to share, if want to share than u should use
net share.

Collapse -

by adelhier In reply to

Same as above.

Collapse -

by Joseph Moore In reply to net use not working

There seems to be some confusion on your environment. On the machine \\Mfgcadserv do you already have the shared folder set up?
Is there a shared folder on that server called "student files" ????That has to be at least the shared name of the folder, not the real name of the folder. It could be the name of the folder also, but the shared name needs to be that.
Now, if you already have "student files" share set up on \\Mfgcadserv, do you already have the Templets sub-folder set up? And also, are there subfolders under Templets set up, like "Drafting 51a 180"??

Basically, you need to set up the whole folder structure first, just to make sure the map will work. IF the folder structure, including the initial folder share, is not set up, then the NET USE will fail.

Now, IF your whole folder structure is set up, then run your NET USE command like this:

net use * "\\Mfgcadserv\student files\templets\"%classname%
Note the quotation marks? That is real important, when a folder name has a space in it. The NET USE command still works like old DOS, and a space in a folder name will screw it up! So, you put the UNC path between quotation marks, and that way NET USE handles it correctly.
And yes, you can use a variable name in a NET USE command.

hope this helps

Collapse -

by adelhier In reply to

you got it right on the dot. It was were i placed the "" on the bat file. It is working fine now.

Thanks you.

Collapse -

by adelhier In reply to net use not working

This question was closed by the author

Back to Windows Forum
8 total posts (Page 1 of 1)  

Related Discussions

Related Forums