/build/static/layout/Breadcrumb_cap_w.png

How to decrypt a encrypted read only files

Hi I am creating a script to decrypt all files in C:\ but unable to decrypt files which are marked as read only. So is there any script to decrypt read only files.

0 Comments   [ + ] Show comments

Answers (2)

Answer Summary:
Posted by: jleitsch 8 years ago
Purple Belt
3

Top Answer

you could try cmd line

attrib -R c:\* /S /D

Bat Example:
###########################
REM Find Read-Only Files
dir /AR /S /B c:\ >> c:\Myfile.txt

REM Uncheck Read-Only Flag
for /F "tokens=*" %%A in (c:\myfile.txt) do attrib -R "%%A"

REM DeCrypt Files
cipher.exe /D /A /S:C:\
cipher.exe /U /N >>"C:\Encrypted_Files-ONLY.log"

REM Set read-only flag:
for /F "tokens=*" %%A in (c:\myfile.txt) do attrib +R "%%A"
###########################

(Added quotes around the last %%A to handle spaces in the file paths)

Comments:
  • The files won't be read only then, which may defeat the purpose of what the OP is trying to achieve. - dunnpy 8 years ago
  • Thanks for the replay
    you cmd line sets read onlt to entire folder

    but I need a script to get all read only files from entire C:\ and then I need to uncheck ready only files and then do my work and then set it back to read only.

    any help should be appreciated. - enthusiasm 8 years ago
    • Get all Read-only files and write them to a file:
      dir /AR /S /B c:\ >> c:\Myfile.txt

      For each file line in MyFile REMOVE read only tag:
      for /F "tokens=*" %%A in (c:\myfile.txt) do attrib -R "%%A"

      Run you decrypt

      For each file line in MyFile SET read only tag:
      for /F "tokens=*" %%A in (c:\myfile.txt) do attrib +R "%%A" - jleitsch 8 years ago
      • Thanks Jleitsch.... everything looks good but when I tried to uncheck/set flag it doesn't set flag when there are spaces between lines (EG: C:\Program Files-there is space between program and files) and it gives an error PARAMETER FORMAT NOT CORRECT - I guess we need to put double quotes between each line to pass this error. I tried this cmd by adding usebackq but still dosent work (for /F "usebackq tokens=*" %%A in (c:\myfile.txt) do attrib -R %%A). so is there any other cmd's or script to solve this.

        Thanks - enthusiasm 8 years ago
      • Jleitsch.. I have 1 more question. I want to get all Read-only files except the C:\WINDOWS folder. so how can we do this. I don't want to touch windows folder. Is there any way to modify this cmd (dir /AR /S /B c:\ >> c:\Myfile.txt
        ) to skip C:\WINDOWS folder

        Thank you - enthusiasm 8 years ago
    • Sorry Enthusiasm....I forgot the qoutes around the %%A in the attib cmd line. Should look like

      do attrib -R "%%A"
      do attrib +R "%%A" - jleitsch 8 years ago
      • Thank you so much Jleitsch... everything looks perfect. Thank you for your help :) - enthusiasm 8 years ago
      • Jleitsch.. I have 1 more question. I want to get all Read-only files except the C:\WINDOWS folder. so how can we do this. I don't want to touch windows folder. Is there any way to modify this cmd (dir /AR /S /B c:\ >> c:\Myfile.txt
        ) to skip C:\WINDOWS folder

        Thank you - enthusiasm 8 years ago
    • Changing the dir command to:
      dir /AR /S /B c:\ | findstr /v "\Windows" >> c:\MyFile.txt
      Will ignore the Windows Directory from listing read-only files - jleitsch 8 years ago
      • Thank you.....and I appreciate your quick response - enthusiasm 8 years ago
      • Hi Jleitsch

        I need help in setting permissions to files. I need to collect all files in C:\ and log them to a files.txt file and change permission in files.txt and set it back to original permissions.

        any help is appreciated. - enthusiasm 8 years ago
Posted by: dunnpy 8 years ago
Red Belt
0
You'll need to supply for more information about the issue you're having to get any help.

What operating system are you working with?
What are you encrypting the files with?
How are you decrypting the files?
What scripting language are you using?
Do you get any error messages?
What have you already tried to attempt to resolve your issue?

Dunnpy

Comments:
  • OS: Windows 7-64bit
    Decrypting files using : %SYS32%\cipher.exe /D /A /S:C:\
    And then scanning to see if there are any encrypted files using : "%SYS32%\cipher.exe"/U /N >"C:\Encrypted_Files-ONLY.log"
    and I do see some files are still encrypted because they are ready only files.
    As per cipher.exe....files cannot be decrypted when they are ready only file attributes.

    So my question is how to decrypt those read only files.

    or else is there any script to get all read only files from entire C:\ and then uncheck ready only files and then do decrypt and then set it back to read only.

    any help should be appreciated. - enthusiasm 8 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ