Add New Text Document to Context Menu in Windows

Abstract: Add a New Text Document option to the Windows right-click context menu by modifying the registry to create files instantly.

Created: 2026-09-20 by
Adding a New Text Document entry directly to the Windows context menu allows you to create plain text files without navigating through the nested "New" submenu. This customization modifies the registry to register a new command that invokes Notepad or creates an empty file in the currently selected directory. The process involves creating a specific registry key under HKEY_CLASSES_ROOT\Directory\Background\shell to define the menu item and its associated action.

Understanding the Registry Structure

The Windows shell uses the registry to determine what options appear when you right-click on desktop backgrounds or within Explorer folders. To add a persistent item outside of the "New" menu, you must target the Background subkey under Directory. This ensures the option appears both on the desktop and inside folder views. The structure requires a parent key for the shell command, a subkey for the default icon, and a crucial command subkey that defines the executable behavior. Without this precise hierarchy, the context menu item may fail to launch or disappear after a system restart.

Creating the Registry Entry

You can achieve this by using the Registry Editor or by importing a prepared .reg file. The following steps outline the manual method using the built-in regedit tool, which gives you full control over the configuration.
  1. Open Registry Editor: Press Win + R, type regedit, and press Enter. Confirm any User Account Control prompts.
  2. Navigate to the Path: Go to HKEY_CLASSES_ROOT\Directory\Background\shell. If the shell key does not exist, create it.
  3. Create the Menu Item: Right-click on shell, select New > Key, and name it AddTextDoc. This internal name identifies the command.
  4. Set the Display Name: With AddTextDoc selected, click on the (Default) value on the right pane. Change its data to &New Text Document. The ampersand (&) before 'N' enables keyboard shortcuts (Alt+N).
  5. Add an Icon (Optional): Right-click AddTextDoc, select New > Key, and name it icon. Set its default value to %SystemRoot%\system32\notepad.exe to give the menu item a recognizable Notepad icon.
  6. Define the Command: Right-click AddTextDoc again, select New > Key, and name it command. This is the most critical step for functionality.

Configuring the Correct Command Value

Many online guides provide incorrect commands that fail because they do not correctly pass the current working directory. The previous error occurred because environment variables like %TEMP% resolve to the user's temporary folder, ignoring the location where the user clicked. Furthermore, using %1 in a background context is unreliable because the background selection does not always populate the first argument index correctly. To fix this, you must use the %V variable, which specifically represents the path of the folder where the context menu was invoked.
  1. Select the command key you created in the previous section.
  2. In the right pane, double-click the (Default) value.
  3. Enter the following string exactly: cmd /c echo. > "%V\New Text Document.txt"
This command works as follows:
  • cmd /c: Runs the command in a new command prompt window and closes it immediately after execution.
  • echo.: Outputs a blank line, effectively creating an empty file stream.
  • > "%V\New Text Document.txt": Redirects that output into a new file named "New Text Document.txt" in the directory represented by %V.
Using echo. is preferred over opening Notepad because it is instantaneous and does not require launching a separate application. If you prefer to open Notepad with the new file, you can use: notepad "%V\New Text Document.txt". However, this will leave an empty Notepad window open, whereas the cmd approach creates the file silently.

Alternative Method: Using a .reg File

For users who prefer a faster setup or want to automate deployment across multiple machines, you can save the following content as add_text_doc.reg and double-click it to import.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\AddTextDoc]
@="&New Text Document"

[HKEY_CLASSES_ROOT\Directory\Background\shell\AddTextDoc\command]
@="cmd /c echo. > \"%V\\New Text Document.txt\""
Note the escaped quotes (\") around %V. This ensures that if your folder path contains spaces, the command executes correctly. After importing, you may need to restart Explorer or log out and back in for the change to take effect. You can quickly restart Explorer by opening Task Manager, finding explorer.exe, and selecting Restart.

Removing the Entry

If you wish to revert the changes, simply delete the AddTextDoc key located at HKEY_CLASSES_ROOT\Directory\Background\shell. Alternatively, you can create another .reg file with the following content to automatically remove it.
Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\Background\shell\AddTextDoc]
Windows 11: Using Shortcuts for Context Menu Items provides additional context on how modern Windows versions handle shell extensions, which may help if you encounter issues with third-party tools interfering with this native registry modification.

Frequently Asked Questions

Why doesn't the file appear immediately after clicking?

The file is created instantly, but Windows Explorer might not refresh the view automatically. Press F5 to refresh the folder or desktop view, and the new "New Text Document.txt" file should appear. If it still does not show, ensure that hidden files are not being filtered out in your View settings.

Can I customize the filename generated by this command?

Yes, modify the command value in the registry. Replace "New Text Document.txt" with your desired name, such as "Readme.txt". However, note that every click will overwrite the same filename if it already exists in that directory, so consider adding a timestamp if you need unique names.

Will this work on Windows 11?

Yes, this registry modification works on Windows 10 and Windows 11. While Windows 11 changed the default context menu appearance, the underlying shell keys remain compatible. You may see the classic context menu or the simplified one depending on your system settings, but the custom entry will function in both.

Is it safe to edit the HKEY_CLASSES_ROOT key?

Editing HKEY_CLASSES_ROOT is generally safe for this specific operation because it redirects to HKEY_CURRENT_USER\Software\Classes for most user-level modifications. However, always back up your registry before making changes. Use File > Export in Regedit to save a backup of the entire hive or just the specific key you are modifying.

How do I make the file open in Notepad instead of just creating it?

Change the command value to notepad "%V\New Text Document.txt". This will create the file if it does not exist and immediately open it in Notepad for editing. This is useful if you frequently start drafting documents from the desktop, though it leaves the Notepad window open until you close it.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More