icacls.exe command-line utility. To export permissions for an entire folder tree—including the root folder itself—run icacls "D:\Shares\Finance" /save "C:\ACLBackups\Finance_ACL.txt" /t /c from an elevated Command Prompt. To restore those permissions later, target the parent directory of the saved folder using icacls "D:\Shares" /restore "C:\ACLBackups\Finance_ACL.txt" /c. Because icacls /save records file and subfolder paths relative to the starting directory rather than as full drive paths, matching the /save path format to the /restore target directory is the single most important step for a clean recovery.
Prerequisites and Scope of an icacls Backup
Before exporting permissions prior to a folder migration, storage move, or bulk permission change, verify what icacls captures and what rights your account needs:
- Administrator elevation is required: Reading and writing ACLs across multi-user directory trees requires an elevated Command Prompt or Windows Terminal session running as Administrator. Without elevation, folders that restrict standard user read-control access will be skipped with
Access is denied, and User Account Control (UAC) will block administrative privileges such asSeBackupPrivilegeandSeRestorePrivilege. - File system support: The target volume must use NTFS (or ReFS where standard Windows ACLs are supported). FAT32 and exFAT volumes do not store discretionary access control lists and will fail if targeted.
- What
/savecaptures and omits: According to Microsoft's built-inicaclscommand specification, the/saveswitch exports only Discretionary Access Control Lists (DACLs)—including explicit allow/deny entries and inheritance flags—in Security Descriptor Definition Language (SDDL) format. It does not save file ownership (Owner), System Access Control Lists (SACLsused for security auditing), or mandatory integrity labels. - Backup file storage location: Always save the exported
.txtACL file outside the directory tree you are backing up (for example, inC:\ACLBackups). Storing the backup file inside the target directory adds the backup file itself to the recursive scan and risks losing the file if the folder is accidentally deleted or locked during migration. - Disk space and runtime on large trees: The output file is encoded in Unicode (UTF-16 Little Endian) and uses two lines per filesystem object: one line for the relative path and one line for its SDDL string. A directory with 100,000 files typically produces a 25 MB to 40 MB ACL file and takes several minutes to scan.
Open an Elevated Command Prompt
While icacls.exe runs in both Command Prompt and PowerShell, running it inside Command Prompt (cmd.exe) avoids PowerShell parsing conflicts with asterisks (*), parentheses, and trailing backslashes inside quoted paths.
Windows 11
- Press
Win + Xon your keyboard or right-click the Start button. - Select Terminal (Admin) or Command Prompt (Admin).
- When the User Account Control prompt appears, click Yes.
- Look at the top tab bar of Windows Terminal. If the active profile says Windows PowerShell, click the downward chevron (
v) next to the new-tab+button and select Command Prompt, or typecmdand press Enter to switch the shell to Command Prompt.
Windows 10
- Click the Start button, type
cmdin the search box, and look at the best match for Command Prompt. - Right-click Command Prompt and select Run as administrator (or click Run as administrator in the right-hand pane).
- Click Yes at the User Account Control prompt.
- Confirm the window title bar begins with Administrator: Command Prompt.
Export NTFS Permissions with icacls /save
How you format the target path in icacls /save determines whether the root folder itself is included in the backup and which directory you must specify during /restore. There are two standard approaches: saving the root folder alongside its contents, or saving only the contents inside the folder.
Warning: Never end a double-quoted path with a single trailing backslash—such as"D:\Shares\Finance\"—in Command Prompt. Native Windows command-line parsing treats\"as an escaped quotation mark rather than the end of the path string, causingicaclsto misread the remaining switches as part of the folder name and fail withInvalid parameter.
Method A: Save the Target Folder and All Subfolders and Files (Recommended)
Use this method when you want to preserve the ACL on the top-level folder itself (Finance) as well as every subfolder and file inside it.
- Create a dedicated folder to hold your permission backups if one does not already exist:
mkdir "C:\ACLBackups" - Run
icaclsagainst the target folder without a trailing backslash or wildcard:
icacls "D:\Shares\Finance" /save "C:\ACLBackups\Finance_ACL.txt" /t /c/save "C:\ACLBackups\Finance_ACL.txt"writes the relative paths and SDDL strings to the specified file./tinstructsicaclsto recurse through all subdirectories and files under the specified path./cinstructsicaclsto continue processing the remaining files even if a locked or inaccessible file generates an error. (Add/qat the end if you want to suppress individual "processed file" output lines on large directory trees, which noticeably speeds up execution.)
- Review the completion summary at the bottom of the Command Prompt output:
Successfully processed 1420 files; Failed processing 0 files
If the failed count is greater than0, scroll up to identify which files returnedAccess is deniedorThe system cannot find the file specifiedbefore relying on the backup.
Method B: Save Only the Contents Inside a Folder (Wildcard Method)
Use this method when you plan to restore permissions into a destination folder that has a different folder name than the original folder, or when you are backing up the root of a drive volume.
- Run
icaclswith\*appended to the target folder path:
icacls "D:\Shares\Finance\*" /save "C:\ACLBackups\Finance_Contents_ACL.txt" /t /c - Notice the difference in scope: using
D:\Shares\Finance\*saves the DACLs for every file and subfolder insideFinance, but does not save the DACL of theFinancefolder itself.
Inspect and Verify the Saved ACL File
Before making changes to your folders or starting a migration, always inspect the generated backup file to confirm it is populated and to see how the relative paths are structured.
- Display the first several lines of the saved ACL file in Command Prompt, or open it in Notepad:
notepad "C:\ACLBackups\Finance_ACL.txt" - Examine the alternating line structure. Every object occupies two lines: the odd-numbered line is the relative path, and the even-numbered line immediately below it is the SDDL string describing the DACL:
Code:Finance D:PAI(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;0x1301bf;;;S-1-5-21-3623811015-3361044348-30300820-1013) Finance\Budgets D:AI(A;OICIID;FA;;;SY)(A;OICIID;FA;;;BA)(A;OICIID;0x1301bf;;;S-1-5-21-3623811015-3361044348-30300820-1013) Finance\Budgets\FY2026.xlsx D:AI(A;ID;FA;;;SY)(A;ID;FA;;;BA)(A;ID;0x1301bf;;;S-1-5-21-3623811015-3361044348-30300820-1013) - Check the very first line of the file:
- If you used Method A (
"D:\Shares\Finance"), the first line isFinance, and all child items begin withFinance\.... - If you used Method B (
"D:\Shares\Finance\*"), the first line is the name of the first child item inside the folder (such asBudgets), with noFinance\prefix.
- If you used Method A (
- Understand the SDDL prefix flags on the second line of each entry:
D:marks the start of the Discretionary ACL.P(SDDL_PROTECTED) means permission inheritance from the parent folder is disabled on that object.AI(SDDL_AUTO_INHERITED) means permission inheritance is enabled and child entries are propagated automatically.- Each parenthetical block
(A;OICI;FA;;;BA)represents an Access Control Entry (ACE), specifying the ACE type (Afor Allow,Dfor Deny), inheritance flags (OIfor Object Inherit,CIfor Container Inherit,IDfor Inherited), permission rights (FAfor File All / Full Control), and the trustee security identifier (SYfor Local System,BAfor Built-in Administrators, or a fullS-1-5-21-...domain/local SID).
Warning: If you edit the ACL backup file manually in a text editor, you must save it with UTF-16 LE encoding and preserve the exact two-line-per-entry structure with no blank lines. Re-saving the file as UTF-8 or ANSI will causeicacls /restoreto fail immediately with syntax or file-not-found errors.
Restore NTFS Permissions with icacls /restore
Warning: Runningicacls /restoreoverwrites the current DACLs of every matching file and folder with the exact DACLs recorded in the backup file, removing any new explicit permissions added since the backup was taken. Ensure you are pointing at the correct parent path before pressing Enter.
When running /restore, icacls combines the directory path you pass on the command line with each relative path listed inside the backup file. Also note that /restore does not use or accept the /t parameter—it automatically processes every entry present in the ACL file.
Restore a Backup Created with Method A (Folder + Contents)
Because the first line of Finance_ACL.txt is Finance, you must point icacls /restore at the parent directory (D:\Shares), not D:\Shares\Finance.
- In your elevated Command Prompt, run:
icacls "D:\Shares" /restore "C:\ACLBackups\Finance_ACL.txt" /c
(If the parent directory is the root of a drive—for example, if you backed up"D:\Finance"—pass the drive letter without quotes or with a dot, such asicacls D:\ /restore "C:\ACLBackups\Finance_ACL.txt" /c.) - Wait for the command to finish and verify the summary line:
Successfully processed 1420 files; Failed processing 0 files
Restore a Backup Created with Method B (Contents Only / Wildcard)
Because Finance_Contents_ACL.txt starts directly with the names of the items inside the folder (Budgets, Budgets\FY2026.xlsx), point icacls /restore directly at the target folder itself:
- In your elevated Command Prompt, run:
icacls "D:\Shares\Finance" /restore "C:\ACLBackups\Finance_Contents_ACL.txt" /c
This also allows you to apply the exact same interior permission structure to a newly created folder with a different name—for example:
icacls "E:\NewServerShares\Accounting" /restore "C:\ACLBackups\Finance_Contents_ACL.txt" /c
Verify the Restored Permissions
After icacls /restore reports zero failed files, verify that both explicit and inherited permissions match your expectations using the command line and File Explorer.
- Run
icaclsagainst the restored folder and a sample subfolder without any switches to inspect their live ACLs:
Code:icacls "D:\Shares\Finance" icacls "D:\Shares\Finance\Budgets" - Check the human-readable output:
Confirm thatCode:D:\Shares\Finance NT AUTHORITY\SYSTEM:(OI)(CI)(F) BUILTIN\Administrators:(OI)(CI)(F) CONTOSO\Finance_Modify:(OI)(CI)(M)(I)appears on child folder entries where inheritance should be active, and does not appear on folders where inheritance was intentionally broken (D:PAIin the backup file). - To verify via the graphical interface in File Explorer:
- Windows 11: Right-click the restored folder in File Explorer and select Properties (or press
Alt + Enterwith the folder selected), switch to the Security tab, and click Advanced. - Windows 10: Right-click the restored folder in File Explorer, select Properties, switch to the Security tab, and click Advanced.
- Windows 11: Right-click the restored folder in File Explorer and select Properties (or press
- In the Advanced Security Settings window, confirm that the permission entries, Inherited from column, and the Enable inheritance / Disable inheritance button state match the pre-change configuration.
Alternate Workflow: Substitute SIDs When Restoring Across Systems or Domains
When you back up permissions on one PC or domain and restore them onto a different standalone PC or a new Active Directory domain, built-in groups like BUILTIN\Administrators (BA) and NT AUTHORITY\SYSTEM (SY) map automatically because they use universal well-known shorthand codes in SDDL. However, local user accounts and domain security groups are recorded as full Security Identifiers (S-1-5-21-...).
If you restore an ACL file onto a system where those SIDs do not exist, Windows applies the raw SIDs anyway, and the Security tab displays them as orphaned Account Unknown (S-1-5-21-...) entries. You can swap an old SID for a new SID on the fly during the restore using the /substitute parameter.
- Find the old and new SIDs in Command Prompt using
whoami /user(for the current account) or PowerShell'sGet-LocalUser/Get-ADGroup:
powershell -NoProfile -Command "Get-LocalGroup -Name 'FinanceUsers' | Select-Object Name,SID" - Run
icaclswith/substituteplaced before/restore:
icacls "D:\Shares" /substitute S-1-5-21-3623811015-3361044348-30300820-1013 S-1-5-21-987654321-123456789-456789123-1005 /restore "C:\ACLBackups\Finance_ACL.txt" /c
You can chain multiple old-and-new SID pairs after/substitutein a single restore command.
Troubleshooting Common icacls Save and Restore Failures
Error: The system cannot find the file specified or Successfully processed 0 files; Failed processing 1 files
- Cause: You pointed
icacls /restoreat the target folder itself ("D:\Shares\Finance") when the backup file already begins with the folder name (Finance). As a result,icaclslooked for a nonexistent"D:\Shares\Finance\Finance"path. - Fix: Open the ACL backup file in Notepad and read line 1. If line 1 is
Finance, run/restoreagainst the parent directory ("D:\Shares").
Error: Invalid parameter When Running /save or /restore
- Cause 1: You included
/ton anicacls /restorecommand. While some administrators habitually type/ton everyicaclscommand, the officialicaclssyntax for/restoreaccepts only/c,/l, and/q. Depending on the argument order, passing/twith/restorecan trigger a parameter error. - Cause 2: You enclosed a path ending in a backslash inside double quotes, such as
"D:\Shares\". - Fix: Remove
/tfrom the/restorecommand, and remove the trailing backslash from any quoted folder path ("D:\Shares"). If you are targeting a root drive letter such asD:\, either omit the quotes (D:\) or add a period after the slash ("D:\.").
Error: Access is denied During /restore Even in an Elevated Command Prompt
- Cause: An administrator account can only overwrite a file or folder's DACL if the administrator group has
Write DAC(WDAC) permissions on the object, or if the administrator is the current Owner of the object. If a faulty script or user locked outBUILTIN\Administratorsand changed ownership to another account (orTrustedInstaller),icacls /restorewill be blocked on those items. - Fix (Rollback and Ownership Recovery):
Warning: Do not runtakeownoricacls /resetrecursively on operating system directories such asC:\Windows,C:\Program Files, orC:\Users\Default. Taking ownership away fromNT SERVICE\TrustedInstalleron system files breaks Windows servicing and application sandboxes. Use this recovery procedure only on user data shares and non-system folders.- Take ownership of the affected data folder tree and assign ownership to the local
Administratorsgroup (/a):
takeown /f "D:\Shares\Finance" /r /a /d y - Grant
AdministratorsFull Control soicaclscan write to every child ACL:
icacls "D:\Shares\Finance" /grant Administrators:(OI)(CI)F /t /c - Re-run your
icacls /restorecommand from the parent directory to overwrite the temporary ACL with your saved backup:
icacls "D:\Shares" /restore "C:\ACLBackups\Finance_ACL.txt" /c
- Take ownership of the affected data folder tree and assign ownership to the local
Resetting a Broken Folder Tree When No Valid Backup Exists
If a permission change goes wrong and you discover that your saved ACL file is incomplete or missing, you can strip all corrupted explicit permissions and force the folder tree to inherit clean default permissions from its parent folder:
- Check the parent folder first (
icacls "D:\Shares") to confirmNT AUTHORITY\SYSTEMandBUILTIN\Administratorshave Full Control(OI)(CI)(F). - Reset the target folder and all items inside it to inherit from the parent:
icacls "D:\Shares\Finance" /reset /t /c