New
#31
Good idea!
Sorry about the stupid, almost illegible font in the screenshot!
Code:Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor] "Icon"="\"C:\\WINDOWS\\system32\\notepad.exe\"" "Position"="Top" "SubCommands"="" [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell] [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell\001flyout] "Icon"="\"C:\\WINDOWS\\system32\\notepad.exe\"" @="Open with Notepad" [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell\001flyout\command] @="\"C:\\WINDOWS\\system32\\notepad.exe\" \"%1\"" [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell\002flyout] @="Open with Text Edit Plus" "Icon"="\"C:\\Program Files (x86)\\VOVSOFT\\Text Edit Plus\\text.exe\"" [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell\002flyout\command] @="\"C:\\Program Files (x86)\\VOVSOFT\\Text Edit Plus\\text.exe\" \"%1\"" [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell\003flyout] @="Open with Black NotePad" "Icon"="\"C:\\WinZ\\blacknotepad.exe\"" "CommandFlags"=dword:00000020 [HKEY_CLASSES_ROOT\*\shell\Open with a Text Editor\shell\003flyout\command] @="\"C:\\WinZ\\blacknotepad.exe\" \"%1\""
Edwin,
Thanks very much. Now I'm going to start working my way through some test entries to try it all out.
Denis
I use the following in a CMD script. The results are shown in my post #25.
"Restart Network Connections" is an elevated shortcut without a UAC prompt.
Code:(REG ADD "HKCR\DesktopBackground\Shell\Network" /V "Position" /T REG_SZ /D "Bottom" /F) (REG ADD "HKCR\DesktopBackground\Shell\Network" /V "SubCommands" /F) (REG ADD "HKCR\DesktopBackground\Shell\Network" /V "Icon" /T REG_SZ /D "%WinDir%\System32\netshell.dll" /F) (REG Add "HKCR\DesktopBackground\Shell\Network\shell\1❤️" /VE /D "Open Network Connections" /F) (REG Add "HKCR\DesktopBackground\Shell\Network\shell\1❤️\Command" /VE /D "CMD /C ncpa.cpl" /F) (REG Add "HKCR\DesktopBackground\Shell\Network\shell\2❤️" /VE /D "Restart Network Connections" /F) (REG Add "HKCR\DesktopBackground\Shell\Network\shell\2❤️\Command" /VE /D "schtasks.exe /run /tn Apps\Restart_Network" /F) (REG Add "HKCR\DesktopBackground\Shell\Network\shell\3❤️" /VE /D "Connect to the Internet" /F) (REG Add "HKCR\DesktopBackground\Shell\Network\shell\3❤️\Command" /VE /D "%SystemDrive%\#\Auto-connect.cmd" /F)
Only seen this morning! I can't tell if you are actually asking me, or (more likely) challenging me to manage it with vbs! Note that I am not proselytising for vbs, its just what I started using 15 years ago. But since I was impressed with the complexity of that mixture of .bat, .vbs and .cmd files that example came from, I thought I'd give it a go... It turns out I know so little about writing to the registry that it took some time. I usually write to HKCU, but found I had to use an admin command prompt to launch the vbs to write directly to HKCR (I couldn't quickly find a way to run the .vbs with admin privileges). This line seemed to work OK:
How did I do? I wrote to a new key so yours (I ran the setup you linked to) was preserved - it seems the default value type works fine.Code:WSHShell.RegWrite "HKCR\.lnk_elevated2\ShellNew\Command", "schtasks /run /tn ""Apps\Create_an_elevated_shortcut"" "
Download this ZIP file and extract the files. Just double-click on "Run_as_administrator.cmd", which will run the VBScript with admin privileges. I cannot mix them into a single .vbs file.
I had to rack my brains before I could mix them into a single file.
A poorly educated Chinese guy can't normally express an implicit meaning in English.