Add 'Edit or Run with' to PS1 File Context Menu in Windows 10  

Page 3 of 5 FirstFirst 12345 LastLast

  1. Posts : 68,953
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #20

    bamajon1974 said:
    The only options I don't have are to run wscript.exe and cmd, both as admin, for VBS files. What would be the correct string syntax for each? I can try out when i get home this evening.
    You can use this below to add "Run as administrator" for VBS files. VBS runs with wscript.exe by default.

    Add Run as administrator to Context Menu of VBS Files in Windows 10
      My Computers


  2. Posts : 521
    Win7 Pro X64, Win10 Pro x640
       #21

    Brink said:
    You can use this below to add "Run as administrator" for VBS files. VBS runs with wscript.exe by default.

    Add Run as administrator to Context Menu of VBS Files in Windows 10
    Got it. Now I want to add "open with command prompt as admin" for vbs files too. Would I use a command like this?

    cmd /c echo|set/p="%V"|powershell -NoP -W 1 -NonI -NoL "SaPs 'cmd' -Args '/c """cd /d',$([char]34+$Input+[char]34),'^&^& start /b %SystemRoot%\System32\CScript.exe" "%1" %"""' -Verb RunAs"
      My Computer


  3. Posts : 68,953
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #22

    bamajon1974 said:
    Got it. Now I want to add "open with command prompt as admin" for vbs files too. Would I use a command like this?

    cmd /c echo|set/p="%V"|powershell -NoP -W 1 -NonI -NoL "SaPs 'cmd' -Args '/c """cd /d',$([char]34+$Input+[char]34),'^&^& start /b %SystemRoot%\System32\CScript.exe" "%1" %"""' -Verb RunAs"
    Not sure why to have the VBS output to a command prompt since it can't run or edit the VBS.
      My Computers


  4. Posts : 521
    Win7 Pro X64, Win10 Pro x640
       #23

    Brink said:
    Not sure why to have the VBS output to a command prompt since it can't run or edit the VBS.
    I'm not sure what the proper command is. VBSFiles by default have a right-click option to open with command prompt, "%SystemRoot%\System32\CScript.exe" "%1" %*. So what I want to do is create another option to open with admin command prompt. I cannot use the RunAs verb since it is already used. I am guessing some sort of powershell command but I am not sure.
      My Computer


  5. Posts : 68,953
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #24

    bamajon1974 said:
    I'm not sure what the proper command is. VBSFiles by default have a right-click option to open with command prompt, "%SystemRoot%\System32\CScript.exe" "%1" %*. So what I want to do is create another option to open with admin command prompt. I cannot use the RunAs verb since it is already used. I am guessing some sort of powershell command but I am not sure.
    It would be best to create a new thread for this.
      My Computers


  6. Posts : 521
    Win7 Pro X64, Win10 Pro x640
       #25

    Ok. Would you prefer a new thread in the Customization section or a follow up to this tutorial?
    Add Run as administrator to Context Menu of VBS Files in Windows 10
    Thanks!
      My Computer


  7. Posts : 68,953
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #26

    bamajon1974 said:
    Ok. Would you prefer a new thread in the Customization section or a follow up to this tutorial?
    Add Run as administrator to Context Menu of VBS Files in Windows 10
    Thanks!
    New thread would be best since it's for something different.
      My Computers


  8. Posts : 521
    Win7 Pro X64, Win10 Pro x640
       #27

    Brink said:
    New thread would be best since it's for something different.
    Ok will do shortly. Thanks!!
      My Computer


  9. Posts : 521
    Win7 Pro X64, Win10 Pro x640
       #28

    Good evening @Brink. For the Open With PowerShell 5.1 as admin, how do you get rid of the following text that appears when the command is launched, to have only the directory path show? /k argument gets rid of the copyright for command and -nologo only works for PowerShell 7. Thanks!

    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.

    Try the new cross-platform PowerShell https://aka.ms/pscore6
      My Computer


  10. Posts : 68,953
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #29

    bamajon1974 said:
    Good evening @Brink. For the Open With PowerShell 5.1 as admin, how do you get rid of the following text that appears when the command is launched, to have only the directory path show? /k argument gets rid of the copyright for command and -nologo only works for PowerShell 7. Thanks!

    Windows PowerShell
    Copyright (C) Microsoft Corporation. All rights reserved.

    Try the new cross-platform PowerShell https://aka.ms/pscore6
    Hello,

    Other than installing it, I'm not aware of a way to remove the suggestion in PowerShell.
      My Computers


 

Tutorial Categories

Add 'Edit or Run with' to PS1 File Context Menu in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  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 18:37.
Find Us




Windows 10 Forums