Why does this not work

Page 3 of 7 FirstFirst 12345 ... LastLast

  1. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #21

    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)
    The above syntax has actually been used in the script in the tutorial below:
    How to Add Create Elevated Shortcut to New Context Menu in Windows 10
    Matthew,

    Two quick samples -
    Code:
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.RegWrite "HKCU\Software\ACME\FortuneTeller\", 1, "REG_BINARY"
    WshShell.RegWrite "HKCU\Software\ACME\FortuneTeller\MindReader", "Goocher!", "REG_SZ"
    These sample lines create these Registry entries
    Code:
    [HKEY_CURRENT_USER\SOFTWARE\ACME]
    [HKEY_CURRENT_USER\SOFTWARE\ACME\FortuneTeller]
    @=hex:01,00
    "MindReader"="Goocher!"

    I have attached relevant extracts from the 2001 VBS Help entry for Registry control but I thought the above samples would create a clearer/simpler picture in the first instance.
    RegWrite Method RegWrite Method.pdf
    RegDelete Method RegDelete Method.pdf
    RegRead Method RegRead Method.pdf


    Denis
      My Computer


  2. Posts : 7,607
    Windows 10 Home 20H2
       #22

    Try3 said:
    is adding a script of my own to a context menu as easy as this?
    As easy as the following one line of command:

    Code:
    (REG Add "HKCR\Directory\Background\shell\Matthew\Command" /VE /D """"D:\A script.cmd"""" /F)
    The context-menu item is Matthew. The script to be run is D:\A script.cmd.
      My Computer


  3. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #23

    Thanks, Matthew.

    So it is well worth my studying possible refinements [dividers, submenus, ...] then doing it.

    My SendTo folder has 36 entries so shoving a lot of them into the main context menu or into context menu sub-menus would help keep it all much easier to use.

    Denis
    Last edited by Try3; 05 Jul 2020 at 14:11.
      My Computer


  4. Posts : 7,607
    Windows 10 Home 20H2
       #24
      My Computer


  5. Posts : 7,607
    Windows 10 Home 20H2
       #25

    Try3 said:
    context menu sub-menus
    Do you mean something like the "Network" below? If so, you have to use /V "SubCommands" /F.

    Why does this not work-context-menu.jpg
      My Computer


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

    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
    Last edited by Try3; 05 Jul 2020 at 14:14.
      My Computer


  7. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
    Thread Starter
       #27

    Try3 said:
    Rich,

    I have been following this thread in order to learn.

    If I understand you correctly, the only action you have had to take to add references to your batch file in the context menu is that reg file?
    Code:
    Windows Registry Editor Version 5.00
     [HKEY_CLASSES_ROOT\*\shell\isLink]
     @="Is This a Link"
     "Extended"=""
     [HKEY_CLASSES_ROOT\*\shell\isLink\command]
     @=""C:\\rexxprogs\\isItaLink.bat" "%1""
     [HKEY_CLASSES_ROOT\Directory\shell\isLink]
     @="Is This a Link"
     "Extended"=""
     [HKEY_CLASSES_ROOT\Directory\shell\isLink\command]
     @=""C:\\rexxprogs\\isItaLink.bat" "%1""
    If it's that simple, I think I'll tidy my context menu up. I've been dumping shortcuts to all my batch/vbs/ps scripts in the SendTo folder because I had thought that adding them to the context menu itself was much more involved.
    I'll find out how to add a divider line to the context menu aswell and then I'll be set. {Addn - I found the method in Context menu separator lines not showing - TenForums which referred to Add Personalize (classic) context menu - TenForumsTutorials}

    Denis
    Yes, that's all there is to it. The Extend just controls whether you need to press the Shift key to see the context menu entry or not.
      My Computers


  8. Posts : 16,949
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #28

    Ztruker said:
    Yes, that's all there is to it. The Extend just controls whether you need to press the Shift key to see the context menu entry or not.
    Rich,

    Thank you so much for having the problem that made you post that .reg code. Whilst I had noticed some threads & tutorials about context menu alterations in the past, I had not 'got it' - I had not realised just how straightforward it all was.

    Denis
      My Computer


  9. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
    Thread Starter
       #29

    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
    I've been looking at this tutorial. It uses the registry editor to create cascading context menus, but once you create one, you can export it and use it as a model to create as many as you want.

    Create Cascading Context Menus With the Windows 10 Registry
      My Computers


  10. Posts : 14,046
    Windows 11 Pro X64 22H2 22621.1848
    Thread Starter
       #30

    Try3 said:
    Rich,

    Thank you so much for having the problem that made you post that .reg code. Whilst I had noticed some threads & tutorials about context menu alterations in the past, I had not 'got it' - I had not realised just how straightforward it all was.

    Denis
    You're welcome. You've helped me many, many times. Glad I could help on this..
      My Computers


 

  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 03:15.
Find Us




Windows 10 Forums