B
bladeraptor
Hi
I am trying to write a batch for NT / 2000 that does two things. The
first is to make a directory based on variables in a text file that
represent a group and a user. The second is then to allocate the user
permissions for that folder
Once the new set of directories containing a folder for the group and
a sub folder for the user has been created, I need to allocate
permissions for each of the user identities culled from the first file
to the new user subfolder.
I had hoped to use XCACLS.exe to allocate permissions for the user
listed in the text file to the newly created user folder.
Is it possible to append a text file with the result of its action.
I.e the text file provides the names for the new directory structure,
could you then append the original file with the path it creates.
So the original text file containing a group name and a user name
separated by a comma would then be appended on each line by the new
path:
group,user
engineering,tbob
creates directory c:\archive\engineering\bob - this path is then
appended to the text file so that the text file now reads:
group,user,path
engineering,tbob,c:\archive\engineering\bob
I am not sure how to do this so tried another solution - which I
haven't managed to get to work, which is to run the string that
creates the directory structure based on the group and folder in the
text file to create the directory and subfolders in reality the first
time and then to run it again a second time but rather than using
MKDIR used echo to output the resutls to a text file.
I was hoping to use the record of these new directories in this second
text file as a second variable in the XCACLS string to allocate
permissions.
But the question is is it possible to use tokens from two separate
text files?
If not is there any other way to pull either of the variables - the
user name variable from the first text file or the file path variable
from the second path into memory to apply it to the XCACLS string
Any help would be much appreciated as I am a real newbie to this
Regards
Bladeraptor
@echo off & setlocal EnableExtensions DisableDelayedExpansion
FOR /F "tokens=1,2 delims=," %%i IN (test.txt) DO MKDIR
C:\test\Archive\%%i\%%j
FOR /F "tokens=1,2 delims=," %%i IN (test.txt) DO ECHO
C:\test\Archive\%%i\%%j >>test2.txt
FOR /F "tokens=1" %%i IN (test.txt) "tokens=1" %%l IN (test.2.txt) DO
XCACLS %%l /T /E /P %%i:RWD
I am trying to write a batch for NT / 2000 that does two things. The
first is to make a directory based on variables in a text file that
represent a group and a user. The second is then to allocate the user
permissions for that folder
Once the new set of directories containing a folder for the group and
a sub folder for the user has been created, I need to allocate
permissions for each of the user identities culled from the first file
to the new user subfolder.
I had hoped to use XCACLS.exe to allocate permissions for the user
listed in the text file to the newly created user folder.
Is it possible to append a text file with the result of its action.
I.e the text file provides the names for the new directory structure,
could you then append the original file with the path it creates.
So the original text file containing a group name and a user name
separated by a comma would then be appended on each line by the new
path:
group,user
engineering,tbob
creates directory c:\archive\engineering\bob - this path is then
appended to the text file so that the text file now reads:
group,user,path
engineering,tbob,c:\archive\engineering\bob
I am not sure how to do this so tried another solution - which I
haven't managed to get to work, which is to run the string that
creates the directory structure based on the group and folder in the
text file to create the directory and subfolders in reality the first
time and then to run it again a second time but rather than using
MKDIR used echo to output the resutls to a text file.
I was hoping to use the record of these new directories in this second
text file as a second variable in the XCACLS string to allocate
permissions.
But the question is is it possible to use tokens from two separate
text files?
If not is there any other way to pull either of the variables - the
user name variable from the first text file or the file path variable
from the second path into memory to apply it to the XCACLS string
Any help would be much appreciated as I am a real newbie to this
Regards
Bladeraptor
@echo off & setlocal EnableExtensions DisableDelayedExpansion
FOR /F "tokens=1,2 delims=," %%i IN (test.txt) DO MKDIR
C:\test\Archive\%%i\%%j
FOR /F "tokens=1,2 delims=," %%i IN (test.txt) DO ECHO
C:\test\Archive\%%i\%%j >>test2.txt
FOR /F "tokens=1" %%i IN (test.txt) "tokens=1" %%l IN (test.2.txt) DO
XCACLS %%l /T /E /P %%i:RWD