Hi all. I'm not sure if this is the correct place to post this, but whatever. I have a simple .reg file that adds the command 'Open Dos Box' to the menu that pops up when you right click a file (on windows) I want it to open a DOS window. Here is the code (working example):

REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\Shell\Open DOS box
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\Shell\Open DOS box\command

With that in mind, one could easily open the registry editor and set the Value Data (of 'command') to "cmd.exe" (command prompt). The only problem is that I want to do it without the use of registry editor. something simple, like notepad. I saw somewhere that you can use something like

@=3D"cmd.exe"

to set value data's, but I've had no luck. Any sugestions?

Dani AI

Generated

Short clarification and a practical, safe pattern you can paste into Notepad: the unnamed (default) value in a .reg is set with @=... (as discovered). To avoid needing Registry Editor or UAC every time, write the keys under the current user hive instead of HKLM — that makes the change per-user and importable without elevation.

A minimal per-user .reg that adds an "Open DOS box" command to folder right‑clicks (opens cmd in that folder):

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\OpenDOSBox]
@="Open DOS box"
"Icon"="%SystemRoot%\\system32\\cmd.exe"

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\OpenDOSBox\command]
@="cmd.exe /k pushd \"%V\""

If you want the context menu on files (so the prompt opens in the file's containing folder) use a command that extracts the file's directory. Put this string as the command value (escape the quotes when you embed it in a .reg):

cmd.exe /k "for %I in (\"%1\") do pushd \"%~dpI\""

Notes and troubleshooting

  • Use /k to keep the window open (/c runs and closes). pushd handles UNC paths too.
  • HKCU\Software\Classes lets normal users import the .reg; HKLM requires admin. As suggested, exporting a working key with Regedit is a quick way to see exact escaping.
  • On 64‑bit Windows be aware of WOW64 redirection if you create keys from a 32‑bit tool; use the 64‑bit reg.exe or Regedit when needed.
  • Always back up the registry (or test in a VM) before importing. If the new verb doesn't appear immediately, restart Explorer or log off.

This approach keeps everything editable in Notepad and avoids manual GUI editing while handling the common pitfalls.

Recommended Answers

All 4 Replies

Why don't you right click on your registry editor and export the registry key in question. Use notepad to open the .reg file -- it just plain text, and examine how the .reg file is setup. I understand you don't want to use regedit but you can view it once to learn how it works.

I know how it all works, but I want it to be a simple .reg file that you can launch, that will take care of everything without the need of actually opening up the registry editor and inputting value data

What I'm saying is create a .REG file so you can see the format it takes ... then take that format and embed it in your code so you can do what you want.

Why don't you use the REG command in DOS? If will prompt the user "Are you sure you want to import this .reg file?" and in vista it will probably launch the UAC to open up the registry editor for the import. I'm not sure if REG will do that.

http://www.computerhope.com/reg.htm

thanks for the recommendation. i figured out that to edit value data in a .reg file, you type:

@="\system command here\"

thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.