Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Command line sharing on another computer

Posted on 2000-05-17
4
167 Views
Last Modified: 2013-12-28
I was just wondering if there was a way to share a folder on another machine from the command line.  Explorer doesn't seem to let you, but the old File manager (winfile) does.  I need to do this from the command line though.  I tried several methods including UNC path and mapping a drive to the other computer.  For instance:
net share myshare=\\myserver\e$\mydir
and
net share myshare=f:\mydir
neither of which worked.  Is there another way to get around this?  
What I'm trying to do is simply automate some folders and shares we create when we make a new user here.  I'm going to be doing this with Perl and would rather avoid using the Perl NT module if at all possible.  I've had nothing but problems with that.  
The other part of the question is, is there a command line way to control the share permissions and the regular directory permissions as well?  
Thanks for the help in advance.  :)
=blain
0
Comment
Question by:timberbt
  • 2
4 Comments
 

Expert Comment

by:bigkeith
ID: 2818654
I think the command line syntax you are looking for is:

net share share-name[=path] [options]

Make a directory available to the network or revoked shared access (the =path form is used only when defining a new shared resource).

Without arguments, the command lists all current shared resources. If just a share name is specified (without options), information about the resource is displayed.

Hope this helps!
0
 
LVL 1

Author Comment

by:timberbt
ID: 2826323
Not quite sure I follow what you're saying here....
I was originally doing the following:
net share testshare=\\server1\e$\test

Where we have testshare being the sharename, and the path to the directory I want to share being designated by the UNC path above.  I want to create a new share.  The directory is previously unshared.  

I get the following:
if I first do a net use and map a drive to a base share (something above the directory I want to share in the structure) I get "The resource named cannot be shared." and it gives me a helpmsg of 3736 which doesn't help at all.  If I do it with the UNC code it simply gives me the syntax statement so it really seems to dislike the UNC path.  

I hope that makes it more clear.
=blain
0
 

Accepted Solution

by:
jwaterson earned 50 total points
ID: 2851039
You need the rmtshare.exe utility from the Resource Kit. You would use it like this:

rmtshare \\myserver\newshare=e:\mydir

You can also grant permissions on the share. To give user jbloggs Full Control of the share you would add the following to the above command:

/g bloggsj:f

You can remove permissions too. See the rktools.hlp file in the Resource Kit for full documentation.

To edit the actual NTFS permissions on the folder, you need to use another utility called cacls.exe. This is included in the core OS and doesn't require the Resource Kit. The syntax is quite involved so I won't give examples, but running cacls /? should sort you out.

Cheers,

J.
0
 
LVL 1

Author Comment

by:timberbt
ID: 2921127
Answer accepted
0

Featured Post

Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Command prompt flashing when starting PC 16 88
Problem to line 23 53
Auto-launch VPN via Wifi 7 49
Windows 10, Hotmail and AdChoices 7 12
NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question