Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows 7 - Add an item to 'new' context menu

This shows how to add items to the "New" dropdown menu. How about taking them away?

Also, I want to make a batch file that automates this. Like this:

@echo off
echo Enter you file extension
set /p ext=
copy con ext.reg
echo Windows Registry Editor Version 5.00 >> ext.reg
echo. >> ext.reg
echo [HKEY_CLASSES_ROOT\.%ext%\ShellNew] >> ext.reg
echo "NullFile"="" >> ext.reg
start /wait ext.reg
del ext.reg
echo Complete
  1. Anything wrong with this, in general?
  2. Can you write to other types of non-text files like registry files with batch files?
  3. Please tell me the registry code for removing an item, so that I can add that.
  4. Most importantly, can a registry file interact with the user, like take in input and make a variable so I don't need a batch file at all?
share|improve this question
  1. I can't judge that, sorry.
  2. I don't know of a good way to write binary (non-text) files from a batch script.
  3. You can remove a registry key by using a .reg file as well. Simply by placing a hyphen before the key.

    To delete a registry key with a .reg file, put a hyphen (-) in front of the RegistryPath in the .reg file. For example, to delete the Test subkey from the following registry key: HKEY_LOCAL_MACHINE\Software
    put a hyphen in front of the following registry key in the .reg file: HKEY_LOCAL_MACHINE\Software\Test
    The following example has a .reg file that can perform this task.

  4. A registry file is only used to manipulate the registry hive. No user interaction (other than a confirmation prompt) is supported in the process to my knowledge.

share|improve this answer
how about the batch file? its the same idea, adding the delete – Jam35B0nd. Mar 1 '12 at 13:54
  1. Absolutely not, just be sure to back up the registry before you go hog wild.
  2. Not very easily. You'd be much better off simply writing a .reg file, which can handle just about everything you need.
  3. In a .reg file, simply add a '-' (minus) after the opening bracket of the item to be removed. See example below.
  4. Nope. Perhaps write a script (or batch file) to automate the generation of a .reg file, which can then be invoked.

Here are the contents of the registry file that I use to eliminate many of the common new template items in Windows 7. Feel free to use it as a basis for your own. REMEMBER TO BACK UP THE REGISTRY FIRST.

    Windows Registry Editor Version 5.00
;Remove everything from the "New" menu other than folder and .txt

; MFC Trace file


; Bitmap

; Contact

; Skype Contact

; Link

; Microsoft Word Documents

; Microsoft Excel Documents

; Microsoft Powerpoint Documents

; Microsoft Outlook entries

; Microsoft Visio Drawing

; Microsoft Project Document

; Microsoft OneNote

; Microsoft Graph

; Microsoft Office Theme

; Microsoft Office List Shortcut

; Microsoft Journal Entry

; Microsoft Publisher



; UMP Profile

; UMS Shortcut

; Zip
share|improve this answer
I get the whole reg part, thanks. I just want to make it easier and interactive (for my family or something) with the batch file. How come I can't write to a reg file? I know it's binary, but isn't everything? – Jam35B0nd. Mar 2 '12 at 12:18
You can write a reg file. You just can't write an interactive reg file. They don't support any kind of user input. – Fopedush Mar 5 '12 at 21:08
so that batch file writing to the reg file part is good? – Jam35B0nd. Mar 14 '12 at 5:09
Yes. ``````````` – Fopedush Mar 14 '12 at 14:50

Just remove this line to get it working:

copy con ext.reg
share|improve this answer
Can you add some explanation as to why this would fix the problem. – ChrisF Mar 9 '13 at 17:34

actually you can programmatically write/read/interact with the registry...

[usage, @ cmd] reg /?

to delete (via reg /? |clip :)

REG DELETE KeyName [/v ValueName | /ve | /va] [/f]

KeyName [\Machine]FullKey Machine Name of remote machine - omitting defaults to the current machine. Only HKLM and HKU are available on remote machines. FullKey ROOTKEY\SubKey ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ] SubKey The full name of a registry key under the selected ROOTKEY.

ValueName The value name, under the selected Key, to delete. When omitted, all subkeys and values under the Key are deleted.

/ve delete the value of empty value name (Default).

/va delete all values under this key.

/f Forces the deletion without prompt.


REG DELETE HKLM\Software\MyCo\MyApp\Timeout Deletes the registry key Timeout and its all subkeys and values

REG DELETE \ZODIAC\HKLM\Software\MyCo /v MTU Deletes the registry value MTU under MyCo on ZODIAC

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.