Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Cacls and a batch file...  (Read 12914 times)

0 Members and 1 Guest are viewing this topic.

GuruGary



    Adviser
    Re: Cacls and a batch file...
    « Reply #15 on: June 23, 2006, 10:26:25 AM »
    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>NUL

    RapedApe

    • Guest
    Re: Cacls and a batch file...
    « Reply #16 on: June 23, 2006, 08:50:28 PM »
    Great, 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 again

    GuruGary



      Adviser
      Re: Cacls and a batch file...
      « Reply #17 on: June 23, 2006, 09:30:44 PM »
      I 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!

      RapedApe

      • Guest
      Re: Cacls and a batch file...
      « Reply #18 on: June 23, 2006, 10:06:04 PM »
      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

      GuruGary



        Adviser
        Re: Cacls and a batch file...
        « Reply #19 on: June 23, 2006, 10:20:35 PM »
        The 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.

        ghostdog74



          Specialist

          Thanked: 27
          Re: Cacls and a batch file...
          « Reply #20 on: June 23, 2006, 10:28:43 PM »
          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 /?

          RapedApe

          • Guest
          Re: Cacls and a batch file...
          « Reply #21 on: June 23, 2006, 10:57:34 PM »
          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. ::)