Create non-english windows explorer right-click menu - windows

How to Add Any Application Shortcut to Windows Explorer’s Context Menu
InstallShield can create registry during installation but I can't create non-english registry successfully.
tested .reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\作業用]
[HKEY_CLASSES_ROOT\*\shell\作業用\command]
#="C:\My Menu\Menu.exe "%1""
1st line command can create
2nd line command can't create
Isn't anyway to create a non-english shortcut e.g. .reg or programming?

Use a chosen term with latin letters for the command and specify the text to display to the user as the default value of that key:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\yourword]
#="作業用"
[HKEY_CLASSES_ROOT\*\shell\yourword\command]
#="\"C:\\My Menu\\Menu.exe\" \"%1\""
Be sure to save the *.reg file with Encoding "Unicode with BOM".
Also remember to escape the values in double quotes: \ must be written as \\. Double quotes " must be written as \".
Also: If there are spaces within the path of your executable, you need to enclose the path in double quotes (escaped with \)

Related

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.

How to set different default programs in windows explorer and command line

I have some ruby scripts and i want to have 2 different default programs for a same file, one program if i double click it in windows explorer just to edit the code (for example in Sublime Text), but when i run it from command line i want the script to be executed. I am using windows 10.
So far, i have set default program for windows explorer sublime text, so the script opens just fine.
In command line i have set
E:\projects\Ruby>assoc .rb
.rb=Ruby.File
and
E:\projects\Ruby>ftype Ruby.File
Ruby.File=C:\bin\ruby200\bin\ruby.exe "%1" %*
Also i have set .RB en the PATHEXT Environment Variables so i just type the name of the script. But the problem is, when i do that, it launches Sublime Text instead of running the script.
If i change default program from windows explorer, it runs just of from command line, but of course it doesn't open sublime text if i double click it.
Is it possible to have 2 different default programs then? One form command line, and another form windows explorer when i double click some script?
It's not easy to do with GUI but it can be done through command line. First of all you have to make your association dynamic. To do it you have to use REG_EXPAND_SZ value type for registry key containing .rb file association. REG_EXPAND_SZ won't be used literally but expanded (=environment variables replaced with their actual values). You can create association with assoc but then you have to use reg add to change it because default type is REG_SZ. Program path must be something like this:
%RUBY_PROGRAM% "%1" %*
Where %RUBY_PROGRAM% is the name of - so far - not existing environment variable. Now you can give a default value to that variable:
setx RUBY_PROGRAM c:\windows\notepad.exe
Now close your command prompt and go to change its properties (from GUI). As alternative you may create a new shortcut for your modified command prompt. Command to execute has to be this:
%comspec% /k ""c:\setup_ruby.bat""
/k lets you execute given batch file at startup, in that batch you just need to set a different value for %RUBY_PROGRAM% environment variable:
SET RUBY_PROGRAM=C:\bin\ruby200\bin\ruby.exe
Now each time you run that special shortcut you will directly execute your Ruby programs. If you don't want to create a special shortcut and you want to apply this rule to every command prompt (regardless where it has been open) then you can add an entry to HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun registry key.
Note that you may just put ftype in startup script (also providing a quit batch) but that will affect all applications until you close command line prompt (even if you double click file from Windows Explorer).

Any known limitations to special characters in shortcut pathname and "Run as Administrator"?

I'm working on a project that creates Windows shortcuts to batch files, and have been testing special characters in the pathname to the batch script. One problem that has me stumped is that a pathname will work when the shortcut is invoked normally, but if "Run as Administrator" is used, it does not work.
For example, if the pathname to the shortcut is "C:\Program Files\myapp )]}##$_-=+'.{[(\bin\hello.bat", I can run it fine when I click on the shortcut. When I select "Run as Administrator" it does not work. The shortcut Target value does have double quotes around the pathname.
I can invoke the above pathname with no problems from the Command Prompt, either running as Administrator or as a regular user.
I put in a prompt at the beginning of the batch script to determine if the batch script itself fails, but it does not. When run-as is used, it appears the script is never launched.
My guess there is something in how Windows (7) performs the run-as operation that is getting tripped up by one (or more) of the special characters in the pathname. Is there any known/documented pathname characters limitations of using run-as (with batch scripts[?])?
UPDATE:
After some testing, I discovered that it is the '#' character that screws things up. When I run a test with that character not present, the run-as operation succeeds. Not sure what is special about that character wrt run-as.
On my Windows 10, if a .cmd file's name contains # or ^ or & , the file cannot be run as an administrator. If a .cmd file's parent folder's name contains # or ^ or & , the file cannot be run as an administrator even if the file's name does not contain # or ^ or &.
Ironically, if a .cmd file's name is:
💞💔㊣〇●♥★✺㊥❤️🏩
the file can be run as an administrator.

Problem in adding string value to registry with .reg file

I'm on win2k3 machine. I wrote a .reg file as below:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\KalleService\Parameters]
"Application"="C:\Projects\KalleService\Bin\KalleService.exe"
When double click the .reg file/say merge, it says registry modified successfully. But it has just created the Parameters key and has not created Application string value.
What could be the problem?
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\KalleService\Parameters]
"Application"="C:\\Projects\\KalleService\\Bin\\KalleService.exe"
try double slashes(\\) instead of single slash (\) in the string value.
try this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\KalleService\Parameters]
#=" "
"Application"="\"C:\\Projects\\KalleService\\Bin\\KalleService.exe\""
or if this doesn't work
make a key manually with a value and export it (a .reg file will be created)
open that file in notepad , modify that file with your values and then again save it. and then run it.
Second way is not efficient but it will get your work done later if you do this

Vim using gf with spaces in filenames

In gVim if the cursor is over a filename (like "C:\Program Files\Vim\vim71\README.txt" ) which contains spaces then using 'gf' fails.
I found the isfname option but the documentation says one should avoid using spaces.
Is there I can make gVim open files under these circumstances ?
You can select text in visual mode and then do a gf on it, that get's round the problem to some extent.
Another option is to use Windows' "8dot3" filenames. I've tested it out in Windows 7 + GVIM succesfully.
Find out the short filename by using the /X flag in the CMD prompt. You want to CD to the parent folder to that which has spaces in it. I'm not sure how to get the whole path at once in "8dot3" form.
Typing "cd " and then dragging from the Explorer's address bar to the CMD window can be easier than typing out the path:
> cd "C:\Users\Fabrice\Documents"
> dir /X
Then use it in Vim, eg:
C:\Users\Fabrice\Documents\MYGAME~1\Skyrim\SkyrimPrefs.ini
If using a folder instead of a file name, the path appears properly expanded in the Netrw listing (:Ex file list).

Resources