Use PowerShell
PowerShell is a powerful command-line tool and script that allows you to automate and manage various aspects of your operating system, hardware, and software. You can use PowerShell to work around the file path length limitation in Windows 11 by using certain commands that can create, modify, or delete files or folders with long file paths.
To use PowerShell, you must have administrator privileges on your computer. In addition, you should be careful because using the wrong command may cause system damage or data loss. Therefore, we recommend that you back up the files or folders that you want to modify before using PowerShell.
The following are some examples of PowerShell commands you can use to work around file path length limitations in Windows 11:
- To create a new file with a long file path, you can use the following command:
New-Item -Path “\\?\C:\Folder1\Folder2\Folder3\…\FolderN\File.txt” -ItemType File
This command will create a file named “File.txt” in the last specified folder. You can rename files and folders as you wish, but be sure to use the “\?” prefix at the beginning of the file path to tell PowerShell that you want to use a long file path.
- To rename a file or folder with a long file path, you can use the following command:
Rename-Item -Path “\\?\C:\Folder1\Folder2\Folder3\…\FolderN\File.txt” -NewName “NewFile.txt”
This command will rename the file “File.txt” to “NewFile.txt”. You can rename files and folders as you wish, but be sure to use the “\?” prefix at the beginning of the file path to tell PowerShell that you want to use a long file path.
- To delete a file or folder with a long file path, you can use the following command:
Remove-Item -Path “\\?\C:\Folder1\Folder2\Folder3\…\FolderN\File.txt” -Force
This command will delete the “File.txt” file. You can rename files and folders as you wish, but be sure to use the “\?” prefix at the beginning of the file path to tell PowerShell that you want to use a long file path. The -Force option will force the deletion of the file or folder without asking for confirmation.
You can type these commands in Windows PowerShell which you can open by pressing the Windows + X key on your keyboard and selecting Windows PowerShell (Admin). You can also save these commands in a PowerShell script (.ps1) file and run them by right-clicking on the file and selecting Run with PowerShell.
Using Third-Party Apps
If you don’t want to change registry settings or use PowerShell, you can use third-party applications that can help you get around the file path length limitation in Windows 11. Some of these applications are:
- Long Path Tool: This app is a simple tool that can detect and delete files or folders with long file paths. You can download this app from its official website at https://longpathtool.com/. Once you install this application, you can run it and see a list of files or folders with long file paths. You can select the file or folder you want to delete and click the Delete button. You can also rename or move a file or folder with a long file path by right-clicking on the file or folder and selecting the appropriate option.
- Path Too Long Auto Fixer: This app is an automated tool that can fix the problem of file paths being too long by randomly renaming files or folders. You can download this app from its official website at https://pathtoolongautofixer.com/. Once you install this application, you can run it and select the drive or folder you want to check. The application will scan the drive or folder and display a list of files or folders with long file paths. You can select the files or folders you want to repair and click the Fix Selected button. The app will rename the file or folder with a shorter, random name.
- Path Scanner: This app is a scanner tool that can display a list of files or folders with long file paths. You can download this app from its official website at https://pathscanner.com/. Once you install this application, you can run it and select the drive or folder you want to check. The application will scan the drive or folder and display a list of files or folders with long file paths. You can export this list to a text file or Excel for further reference.