question about parameter on add line to the context menu - windows

I wrote the following lines in windows registry...
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\exefile\shell\runDOT]
#="run in DOT environment"
[HKEY_CLASSES_ROOT\exefile\shell\runDOT\command]
#="\"D:\\T00Ls\\x64\\DOT\\DOT.exe\" \"%1\""
that works like a charm!
Through parameter %1, any executable file that is selected through the context menu in explorer, is loaded by DOT.exe
To load a second file with the same name, but with a different extension, how will be the variable that I should use?
When creating context menu entries in the registry, what variables can be passed to the commands?
rmk.: I found the following doc, but not helped me.
Extending Shortcut Menus

Related

How to add cmd command execution to right click menu on Windows?

I’m trying to add a menu button when I right click a file and the button will let me execute a command. To be more specific, I’m trying to right click a apk file, and the I can execute a “adb install” command of the selected file. I did some search and found out to add a menu item we need to modify the registry. But I’m not sure how to execute a command and moreover, how can I get the current selected file in right click?
Any help will be much appreciated!
Read about Verbs and File Associations on MSDN.
If you don't need it to be the default command, adding it under SystemFileAssociations is a good idea and works on Windows XP and later.
A minimal .reg file might look like this:
REGEDIT4
[HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\.apk\shell\AdbInstall]
#="ADB Install"
[HKEY_CURRENT_USER\Software\Classes\SystemFileAssociations\.apk\shell\AdbInstall\command]
#="\"C:\\path\\to\\androidsdk\\adb.exe\" install \"%1\""
%1 is replaced with the full path of the file you right-click on.

Why double clicking opens application but does not load file?

I made an application for editing .cue files. If I use a .bat file containing
CueEditor.exe Ah.cue
line, it opens application and loads file properly; so it seems command line arguments are able to be passed properly; but double clicking on a .cue file opens application without loading file.
.reg files which include registry keys which are created by the setup program for registering the application default for .cue files are these:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.cue]
#="CueFile"
and
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\CueFile]
[HKEY_CLASSES_ROOT\CueFile\Defaulticon]
#="\"C:\\Program Files\\Cue Editor\\CueEditor.ico\""
[HKEY_CLASSES_ROOT\CueFile\shell]
[HKEY_CLASSES_ROOT\CueFile\shell\open]
[HKEY_CLASSES_ROOT\CueFile\shell\open\command]
#="\"C:\\Program Files\\Cue Editor\\CueEditor.exe\" \"%1\""
What is wrong?
By the way, I use Windows XP.
At last I found answer after which I had ensured that the registry settings are appropriate. Windows passes the path as string but puts quotation marks of each side like this:
"C:\Documents and Settings\ABC\Desktop\AH.cue"
and if it is being thought that can be used as path like bare C:\Documents and Settings\ABC\Desktop\AH.cue string, it does not work. Quotation marks at the ends should have been cleaned first.

Adding batch script to Windows 8 context menu

I saw some other questions about this here, but still got nothing working for what I want.
I want to right click the empty space of a folder, and see a menu for executing a batch file for the current folder.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\treeFiles]
#="Execute treeFiles"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\shell\treeFiles\command]
#="C:\treeFiles.bat \"%V\""
#="C:\\treeFiles.bat -d \"\"%V\"\""
With the above, I can only see the item when I right-click a folder (not the empty space), and the batch will execute relative to it's self path, not the current folder.
Any idea how to fix?
Use this instead:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\treeFiles]
#="&Execute treeFiles"
"Icon"="%SystemRoot%\\System32\\shell32.dll,71"
[HKEY_CLASSES_ROOT\Directory\Background\shell\treeFiles\command]
#="C:\\treeFiles.bat \"%V\""

Pass multiple parameters with open command

I am looking for ways to open multiple documents in a single application instance. For example, open multiple documents in a single, new gVim instance.
I had found this code on here before, but it doesn't quite do what I want.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Open with &Vim]
[HKEY_CLASSES_ROOT\*\Shell\Open with &Vim\command]
#="\"C:\\Users\\avt\\Programs\\PortableApps\\gVimPortable\\gVimPortable.exe\" -p --remote-tab-silent \"%1\" \"%*\""
The problem is that it is giving a similar effect, but not the one I want (it opens the selected documents in an existing gVim instance, not all of them in their OWN new gVim instance). What I want is like this:
Highlight 5 documents in Explorer
Open them
A single gVim instance opens with all 5 documents as tabs
I think this would work, if only I could pass multiple arguments!
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Open with &Vim]
[HKEY_CLASSES_ROOT\*\Shell\Open with &Vim\command]
#="\"C:\\Users\\avt\\Programs\\PortableApps\\gVimPortable\\gVimPortable.exe\" -p \"%allselecteddocuments\""
Thanks!
EDIT: I just found out I can do this by adding a custom SendTo command (create a shortcut in your SendTo folder to gVim add -p to the Target. Is there any way to do this outside of the SendTo menu?
Create a shortcut in C:\Users\\\<user>\AppData\Roaming\Microsoft\Windows\SendTo folder with ONLY the exe name.
Now you should be able to select random multiple files and use context SendTo\<shortcut> to open them with your designated exe.

Windows shell add item to context menu when click on blank part of folder

Sorry if this has been asked before, I've been looking around and it's hard to find what I want.
I know how to add a context menu item to a folder like so:
[HKEY_CLASSES_ROOT\Folder\shell\console2]
#="Open Console2 Here"
[HKEY_CLASSES_ROOT\Folder\shell\console2\command]
#="C:\\Program Files\\Console\\console.exe -d \"\"%1\"\""
but, that only works for right clicking on a folder. I want it so that you can be inside the folder, and click a blank part of that folder and get the context menu item as well. I also tried HKEY_CLASSES_ROOT\Directory\shell as well, but it does the same.
I figured out the answer. The folder is actually Directory\Background, you have to add the empty string value of NoWorkingDirectory into it, and the %1 in the command becomes a %V
[HKEY_CLASSES_ROOT\Directory\Background\shell\console2]
#="Open Console2 Here"
"NoWorkingDirectory"=""
[HKEY_CLASSES_ROOT\Directory\Background\shell\console2\command]
#="C:\\Program Files\\Console\\console.exe -d \"\"%V\"\""
Source:
saviert's comment at http://www.howtogeek.com/howto/windows-vista/make-command-prompt-here-always-display-for-folders-in-windows-vista#comment-57856
Console2 rocks. I added an 'Cmd here (Console2)' item to my explorer context menu.
Save the text below in a file named open-console2.reg then open it to import it to the Windows registry.
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2]
#="Cmd here (Console2)"
"NoWorkingDirectory"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2\command]
#="\"C:\\Program Files (x86)\\Console2\\Console.exe\" -d \"%V\"\\"
Bonus 'bash here' item (assumes you have a Console2 tab named 'bash').
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2_bash]
#="Bash here (Console2)"
"NoWorkingDirectory"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2_bash\command]
#="\"C:\\Program Files (x86)\\Console2\\Console.exe\" -t Bash -d \"%V\"\\"
I think the relevant part of the TortoiseSVN installer is here. Perhaps you can figure out all the necessary registry keys from that.
None of the above worked for me.
But this does (tested on Windows 7 Pro x64):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\Open console here\command]
#="u:\\users\\dave\\data\\bin\\Console2\\Console.exe cmd -r \"/k pushd %L\""
Replace the path with the path to your copy of console.exe (of course).
#Ben Voigt mentioned TortoiseSVN, you can also see WinMerge shell extension source code, or at last: create your own extension from scratch; I wanted to do something like this for XP but I have lots of other stuff to do now.
As a workaround, you can just open a folder in XP, and then select View->Explorer Bar->Folders, to have folder tree on left, and then you're able to right-click the folder (active folder gets hightlighted automatically).
Here it is if you prefer MinGW.
#!/bin/sh
reg add 'HKCR\Directory\Background\shell\sh' -d 'Open Bash window here'
reg add 'HKCR\Directory\Background\shell\sh\command' \
-d 'C:\MinGW\msys\1.0\bin\sh.exe -l'
printf 'cd -' >> ~/.profile
superuser.com/a/387273
According to my personal experience of Windows XP (SP3), you can open Console2 inside the current directory with a context menu entry using the following .reg file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\console2]
#="Console2 Here"
[HKEY_CLASSES_ROOT\Folder\shell\console2\command]
#="C:\Program Files\Console\console.exe -d \"%1\""
If you look at the key value inside regedit.exe , you should see:
C:\Program Files\Console\console.exe -d "%1"
instead of:
C:\Program Files\Console\console.exe -d ""%1""
The latter would open Console2 in its default start directory.
This can be achieved in XP as well.
First open the program Run with the Windows key + R,
and type Regedit in the textbox.
Press Enter.
In the Registry open the Key : HKEY_CLASSES_ROOT
and then : *
You will now see a key called : shell
Rightclick on shell and point to New.
Click in de menu on Key.
Now type a name of your choice which you want to appear in the Rightclick menu.
Rightclick on the name you chose, again point to New and click Key.
Now type : command
Click on command and in the right pane of the Registry doubleclick on (Default).
In the textbox Value Data, type the path to an application you want to open via the chosen name in the rightclick menu.
For example : "C:\Program Files\CCleaner\CCleaner.exe"
Then type after the path : %1,
and leave a space between the end of the path and %1
It should look like this :
"C:\Program Files\CCleaner\CCleaner.exe" %1
This way, it's possible to open any kind of application you want.
There's only one drawback,
you have to rightclick another file to see the chosen name with which you can open the application.
When you rightclick a folder this will not work.

Resources