Why does this not work

Page 5 of 7 FirstFirst ... 34567 LastLast

  1. Posts : 7,451
    Windows 10 Home 20H2
       #41

    mngerhold said:
    (I couldn't quickly find a way to run the .vbs with admin privileges)
    By googling, I found a very simple way to do so without a CMD script, Command Prompt, and PowerShell.
    Code:
    Set l=CreateObject("Shell.Application"):If WScript.Arguments.length = 0 Then
    l.ShellExecute"wscript.exe",""""&WScript.ScriptFullName&""""&" ✱","","RunAs",1
    Else
    MsgBox "Hello!"
    End If
    Replace MsgBox "Hello!" with your VBScript commands.
    Googling has made up for my poor education.
      My Computer


  2. Posts : 11,327
    Windows 10 Home x64 Version 21H2 Build 19044.1706
       #42

    Matthew,

    What an excellent method.

    Did you keep a note of the source?
    [I like to note the sources in any code I've copied]

    Denis
      My Computer


  3. Posts : 7,451
    Windows 10 Home 20H2
       #43
      My Computer


  4. Posts : 958
    Microsoft Windows 10 Home
       #44

    Ramesh to the rescue! One of my buddies from the XP Newsgroup days!
      My Computer


  5. Posts : 11,327
    Windows 10 Home x64 Version 21H2 Build 19044.1706
       #45

    Matthew,

    And thank you for the link. I have used a lot of Ramesh Srinivasan's suggestions over the years.

    And yours. I've come round to your ideas about using Reg commands instead of .reg files to set up my Context menus.
    - One of my intended Context menu entries is a Networking submenu containing a set of scripts to copy folders-files to the Desktops of my other computers [amongst other things]. I currently use shortcuts to them in my SendTo menu.
    - I always like to write one script that I use without alteration on all three computers.
    - The only way to avoid creating a redundant Networking entry [to copy to its own Desktop] is to have a test for ComputerName that skips certain commands
    - .reg files cannot contain ComputerName tests so I will change to using a batch file instead.

    Denis
    Last edited by Try3; 07 Jul 2020 at 02:31.
      My Computer


  6. Posts : 7,451
    Windows 10 Home 20H2
       #46

    You can mix ".cmd", ".vbs", ".ps2", and ".xml" into a batch file, but you cannot do the same into a .reg file, which I seldom use.
      My Computer


  7. Posts : 7,451
    Windows 10 Home 20H2
       #47

    Code:
    (REG Add "HKCR\DesktopBackground\Shell\Network\shell\1❤️" /V "CommandFlags" /T REG_DWORD /D "0x00000040" /F)
    @Try3, if you add the above line into my post #35, a separator line will appear under "Open Network Connections" as shown below:

    Why does this not work-line.jpg
      My Computer


  8. Posts : 11,327
    Windows 10 Home x64 Version 21H2 Build 19044.1706
       #48

    Matthew,

    I've been using "0x00000020" rather than "0x00000040" but I've just tested both and they seem to have the same effect as each other anyway.

    Denis
      My Computer


  9. Posts : 889
    W10-2009 19042.1348
       #49

    Matthew Wai said:
    By googling, I found a very simple way to do so without a CMD script, Command Prompt, and PowerShell.
    Thanks (can't click 'thanks' button apparently until I do so for someone else). Martin
      My Computer


  10. Posts : 17,831
    Windows 10
       #50

    Try3 said:
    Matthew,

    I've been using "0x00000020" rather than "0x00000040" but I've just tested both and they seem to have the same effect as each other anyway.

    Denis
    CommandFlags 40 puts the separator after the entry,

    CommandFlags 20 puts the separator before the entry...

    Why does this not work-000689.png
      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 16:03.
Find Us




Windows 10 Forums