Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

Run With Arguments


Plamdi
 Share

Recommended Posts

I distinctly remember making one of these before... but I needed the functionality - and re-writing one would have been faster than sifting through all the files on my computer (especially since it's just modified somewhat from i_conv.vbs). If anyone finds a bug, LMK... I haven't tested all the extensions, but as far as I'm aware it's not necessary to explicitly call upon "handlers" (like WSCRIPT or CMD).

Paste into notepad, save as RUNWARGS.VBS.

 

' (c) 2006 aractus.com, this file must not be sold, you may distribute it' freely so long as it remains unmodified with all internal documentation.'' This program allows you to run any program with arguments, simply' right click and select "Run With Arguments" once isntalled. It is' uninstallable from Add or Remove Programs - or by running the' file directly.'' Installation:' 1. Double click on i_conv.vbs to install/uninstall' 2. Run "WScript.exe i_conv.vbs" from a command prompt or the run dialogue.' 3. Run "WScript.exe i_conv.vbs /s" to achieve a silent installation.Option Explicit:On Error Resume NextDim WshShell,fso,a,f,i,o,p,q(10),t,u,v,w:w=0Set WshShell=WScript.CreateObject("WScript.Shell")Set fso=CreateObject("Scripting.FileSystemObject")p=UCase(WshShell.Environment("PROCESS")("SystemRoot"))&"\SYSTEM32\"If UCase(WScript.ScriptFullName)<>p&"RUNWARGS.VBS" Then fso.CopyFile WScript.ScriptFullName,p&"runwargs.vbs"If Wscript.Arguments.Count=1 ThenIf Wscript.Arguments(0)="/REM" Thenv=MsgBox("Are you sure you want to remove the Run With Arguments shell extensions?",292,"Remove shell extensions confirmation")If v=7 Then WshShell=Nothing:Wscript.Quit(1)w=7ElseIf UCase(Wscript.Arguments(0))="/S" Or UCase(Wscript.Arguments(0))="/SILENT" Thenw=6ElseErrHndlr()End IfElseIf Wscript.Arguments.Count=2 ThenIf Wscript.Arguments(0)="/RUN" Thenw=InputBox(Wscript.Arguments(1)&"."&vbCrLf&vbCrLf&"Enter command line arguments below.","Run With Arguments")WshShell.Run(Wscript.Arguments(1)&" "&w)Set WshShell=NothingWscript.Quit(1)ElseErrHndlr()End IfEnd Ifq(0)="com":q(1)="exe":q(2)="bat":q(3)="cmd":q(4)="lnk":q(5)="vbs":q(6)="vbe":q(7)="js":q(8)="jse":q(9)="wsf":q(10)="wsh"If w=0 Then w=MsgBox("Do you want the Run With Arguments shell extensions?",292,"Enable/Disable shell extensions")For i=0 To UBound(q)a=WshShell.RegRead("HKCR\."&q(i)&"\")If a<>"" Thent="HKCR\"&a&"\shell\"&"Run_With_Args\"If w=6 ThenWshShell.RegWrite t,"Run With Arguments"WshShell.RegWrite t&"command\","WScript.exe """&p&"runwargs.vbs"" /RUN ""%d"""ElseWshShell.RegDelete t&"command\":WshShell.RegDelete tEnd Ift="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\runwargs\"If w=6 ThenWshShell.RegWrite t,""WshShell.RegWrite t&"DisplayName","Run With Arguments Shell Extensions (Removal)"WshShell.RegWrite t&"UninstallString","WScript.exe """&p&"runwargs.vbs"" /REM"WshShell.RegWrite t&"NoModify",1,"REG_DWORD"WshShell.RegWrite t&"NoRepair",1,"REG_DWORD"ElseWshShell.RegDelete t&"NoModify":WshShell.RegDelete t&"NoRepair"WshShell.RegDelete t&"UninstallString":WshShell.RegDelete t&"DisplayName":WshShell.RegDelete tfso.DeleteFile(p&"runwargs.vbs")End IfEnd IfNext'iSet WshShell=NothingWscript.Quit(1)sub ErrHndlr()MsgBox "Invalid parameters were given. The only correct user command line is /s or /silent.",16,"runwargs.vbs error"Set WshShell=NothingWscript.Quit(0)End Sub
Edited by Plamdi
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...