|
Answer» For the original question, you only need the second line. Change:
Code: [Select]for /f "delims=" %%a in (caclslist.txt) do (echo y|cacls "%%a" /p guest:n) for /f "delims=" %%a in (caclslist.txt) do echo y|cacls.exe "%%a" /p guest:n|find /i "processed">>cacls.log 2>NUL into
Code: [Select]for /f "delims=" %%a in (caclslist.txt) do echo y|cacls.exe "%%a" /p guest:n|find /i "processed">>cacls.log 2>NULGreat, thanks for all your help. TOOK a little messing around but it's now working perfectly. Going through all this I was wondering if there was any site or book you could recommend to check out to learn some of this stuff. I know bits and pieces but not really enough to get by... obviously. Anything you can recommend would be appreciated.
Thanx againI don't know of any books, but try looking through all the commands on these 2 sites.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ntcmds.mspx http://www.ss64.com/nt/
They are both good references.
Good luck!Thanx for the links. I'll be SURE to work my way through them. There were a couple things I was wondering for now though. What does the '2>NUL' do and also, what's with the "delims="?
ThanxThe 2>NUL is redirecting output.
By default the '>' symbol will redirect output from STDOUT which is usually non-error messages meant for the screen. You can redirect to a file with ">filename" which is the same as "1>filename", or you can redirect the output to the "black hole" of NUL with ">NUL". But besides STDOUT, there is also STDERR, which are error messages and are separate from STDOUT. To redirect error messages, you use "2>". If you want to redirect both standard and error messages to NUL you can use ">NUL 2>&1" which basically means send STDIO to NUL and send STDERR to the same handle as "1>".
Here is more info on redirection: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/redirection.mspx
The "delims=" in a FOR statement means there are no delimeters, so everything on the entire line will be placed into the variable. This is USED if you don't want to break the line apart, but keep it all togehter. In the case of your question, it was used to deal with any possible spaces in the file names.
I hope that CLEARS things up a little bit.Quote Thanx for the links. I'll be sure to work my way through them. There were a couple things I was wondering for now though. What does the '2>NUL' do and also, what's with the "delims="?
Thanx 2>Nul means redirecting standard error to nul. meaning to suppress errors. For more info, check out http://www.robvanderwoude.com/index.html. This site also a lot of great resources and examples on batch.
delims= means delimiters. for more infor, check the for /?Cool, thanx again for all the help guys. I think I'm all set now. Hopefully I'll be able to help some people on here once I figure out what the *censored* I'm doing.
|