For /R I:\Users

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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" ?
 
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" ?
 
Back
Top