When you perform a file operation (e.g., delete, rename, copy, or move a file or folder) in Windows, you’ll see the corresponding “Undo…” option in the desktop right-click menu. One of the options, “Undo Copy”, “Undo Move”, “Undo Rename”, or “Undo Delete” is shown in the context menu.
Similarly, when you undo a rename/cut/copy/paste operation using the context menu or using the Ctrl + Z keyboard shortcut, you’ll see the corresponding “Redo…” entry context menu — e.g., Redo Copy, Redo Rename, Redo Delete, Redo Move.
Pressing Ctrl + Z in the Explorer shell (this includes the folder view, taskbar, and the desktop), will Undo the last file operation, such as the delete, rename, move, or copy. Likewise, Ctrl + Y will Redo the file operation.
The Undo and Redo feature, however convenient it may be, can also be a big obstacle for many users. Sometimes, users tend to inadvertently click on the Undo or Redo option via the context menu, which results in an undesirable event. The worst thing is that the last file operation may have happened hours back, and you don’t even know what exactly the accidental undo/redo command performed. It happens silently, and the user is not informed about the details of the undo/redo operation. The user might not even notice that it happened.
If you want to disable the “Undo” and “Redo” features (i.e., the “Undo” and “Redo” options in the context menu, Undo and Redo icons in Quick Access Toolbar in File Explorer, and the Ctrl +Z and Ctrl +Y hotkeys in Windows), there is a simple and undocumented registry edit.
Disable “Undo” & “Redo” Feature in Windows
To disable the Undo and Redo features (for file operations) in the Explorer or Shell environment, follow these steps:
- Start the Registry Editor (
- Go to the following key:
- Create a DWORD value in the right pane, and name it as
- Leave the
0.(This registry value dictates the number of undo and redo levels supported in the Explorer shell. For instance, if it’s set to 2, Explorer remembers the last 2 file operations only. If set to 0, it means Undo and Redo features are disabled.)
- Exit the Registry Editor.
- Important: Log off and log back into your user account. Alternatively, restart the Explorer shell for the changes to take effect immediately.
This removes the “Undo” and “Redo” options in the context menu and its corresponding Ctrl + Z and Ctrl + Y hotkeys. The Undo and Redo icons in the Quick Access Toolbar in File Explorer will be grayed out.
To accomplish the above using the command-line, open a Command Prompt window and type:
reg add "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v MaxUndoItems /d 0 /t REG_DWORD /f
To revert the setting back, run:
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /v MaxUndoItems /f
The above registry edit applies only to the Explorer shell; it does not remove the undo and redo feature or the Ctrl + Z and Ctrl + Y hotkeys in individual applications, such as Office. If you wish to restore the undo and redo feature later on, then delete the
MaxUndoItems registry value and re-login to your account. The registry edit should work in all Windows versions. I last tested this on Windows 10 21H2.
Explorer Undo and Redo For VS Code Users
To disable the undo and redo options for file operations in the “Visual Studio Code” application’s Explorer panel, you can use the new setting
explorer.confirmUndo introduced in VS Code version 1.64.
Explorer: Confirm and disable Undo
- The File Explorer has long supported an Undo stack to revert file and folder edits (rename, cut/copy/paste, move, import, etc.). Some users find this functionality unexpected, so there is now a setting to disable Undo in the Explorer (
- Additionally, a new setting (
explorer.confirmUndo) was added to configure how frequently the Explorer will prompt for confirmation when performing an Undo. By default, the Explorer will prompt more frequently than before to ensure destructive undoing doesn’t accidentally happen, but this can be changed to the old behavior with the value “light”, or set to “verbose” to prompt before all Undo actions.
You can find a short video about the above features in the following tweet.
Today's @code tip: Explorer undo
Use ctrl+z / cmd+z with the explorer focused to undo file deletes, moves, and renames
— Matt Bierner (@mattbierner) March 7, 2022
I hope the undocumented
MaxUndoItems registry value helped you disable the undo and redo feature in Explorer. Let’s know your comments.
One small request: If you liked this post, please share this?One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!