Why does this not work

Page 4 of 7 FirstFirst ... 23456 ... LastLast

  1. Posts : 17,838
    Windows 10
       #31

    Try3 said:
    Matthew,

    Thanks, that's exactly what I mean. Please would you show me the whole of that command so I can use it as a prime example while I read up on the subject properly.

    Denis
    Why does this not work-000678.png
      My Computer


  2. Posts : 16,786
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #32

    Edwin said:
    ...
    Edwin,

    Brillaint. Many thanks. Please could you copy & post that .reg file to save me a bit of typing?

    Denis
      My Computer


  3. Posts : 17,838
    Windows 10
       #33

    Try3 said:
    ...Please could you copy & post that .reg file to save me a bit of typing?
    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\""
      My Computer


  4. Posts : 16,786
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #34

    Edwin,

    Thanks very much. Now I'm going to start working my way through some test entries to try it all out.

    Denis
      My Computer


  5. Posts : 7,606
    Windows 10 Home 20H2
       #35

    Try3 said:
    Please would you show me the whole of that command so I can use it as a prime example while I read up on the subject properly.
    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)
      My Computer


  6. Posts : 16,786
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #36

    Matthew Wai said:
    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)
    Matthew,

    Thanks for that. I'm studying the topic now and all these examples are helping me make sure I have properly understood each part.

    Denis
      My Computer


  7. Posts : 1,218
    W10-Pro 22H2
       #37

    Matthew Wai said:
    How would you write the following in VBScript?
    Code:
    (REG ADD "HKCR\.lnk_elevated\ShellNew" /V "Command" /T REG_SZ /D "schtasks /run /tn ""Apps\Create_an_elevated_shortcut""" /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:
    Code:
    WSHShell.RegWrite "HKCR\.lnk_elevated2\ShellNew\Command", "schtasks /run /tn ""Apps\Create_an_elevated_shortcut"" "
    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.
      My Computer


  8. Posts : 7,606
    Windows 10 Home 20H2
       #38

    mngerhold said:
    (I ran the setup you linked to)
    What setup? Which link?
      My Computer


  9. Posts : 1,218
    W10-Pro 22H2
       #39

    Matthew Wai said:
    What setup? Which link?
    this in post 19: How to Add Create Elevated Shortcut to New Context Menu in Windows 10
      My Computer


  10. Posts : 7,606
    Windows 10 Home 20H2
       #40

    mngerhold said:
    (I couldn't quickly find a way to run the .vbs with admin privileges)
    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.

    mngerhold said:
    I was impressed with the complexity of that mixture of .bat, .vbs and .cmd files that example came from
    I had to rack my brains before I could mix them into a single file.

    mngerhold said:
    I can't tell if you are actually asking me, or (more likely) challenging me to manage it with vbs!
    A poorly educated Chinese guy can't normally express an implicit meaning in English.
    Why does this not work Attached Files
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 20:14.
Find Us




Windows 10 Forums