For /R I:\Users

G

Guest

What I want to do is pick out the directory names in the users folder and
then share them. I have done this in the past by creating a Text file and
using it for input, but it seems to me I should be able to skip that step.

Here is my original batch file;

for /F "usebackq delims==" %%I in (users.txt) do Call :begin %%I
goto :EOF

:begin
set USER=%1
::Share Dir
net share %user%$=I:\users\%user% /Grant:Everyone,Full

I create users.txt by running dir /b *. >users.txt


seems like "FOR /R [[drive:]path] %variable IN (set) DO command
[command-parameters]" should work, but I can't figure out what to put in
(set).

TIA,

Mike
 
M

Michael Bednarek

What I want to do is pick out the directory names in the users folder and
then share them. I have done this in the past by creating a Text file and
using it for input, but it seems to me I should be able to skip that step.

Here is my original batch file;

for /F "usebackq delims==" %%I in (users.txt) do Call :begin %%I
goto :EOF

:begin
set USER=%1
::Share Dir
net share %user%$=I:\users\%user% /Grant:Everyone,Full

I create users.txt by running dir /b *. >users.txt


seems like "FOR /R [[drive:]path] %variable IN (set) DO command
[command-parameters]" should work, but I can't figure out what to put in
(set).

PUSHD I:\users
FOR /D %d IN (*) DO NET SHARE %d$=I:\users\%d /Grant:Everyone,Full
POPD

It seems odd that you create shares supposedly hidden and then grant
full rights to Everyone. Why not: "/Grant:%d,Full" ?
 
G

Guest

Thanks, I was going about it backwards.

Mike

Michael Bednarek said:
What I want to do is pick out the directory names in the users folder and
then share them. I have done this in the past by creating a Text file and
using it for input, but it seems to me I should be able to skip that step.

Here is my original batch file;

for /F "usebackq delims==" %%I in (users.txt) do Call :begin %%I
goto :EOF

:begin
set USER=%1
::Share Dir
net share %user%$=I:\users\%user% /Grant:Everyone,Full

I create users.txt by running dir /b *. >users.txt


seems like "FOR /R [[drive:]path] %variable IN (set) DO command
[command-parameters]" should work, but I can't figure out what to put in
(set).

PUSHD I:\users
FOR /D %d IN (*) DO NET SHARE %d$=I:\users\%d /Grant:Everyone,Full
POPD

It seems odd that you create shares supposedly hidden and then grant
full rights to Everyone. Why not: "/Grant:%d,Full" ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top