cscript //E:JScript //nologo "%~f0" // %*
Pass a double slash to end your own parsing of cscript
arguments.
note : I don't know if it is documented anywhere, but tested in windows 7 and 10
Test script:
Option Explicit Dim argument For Each argument In WScript.Arguments WScript.Echo "argument: " & argument Next For Each argument In WScript.Arguments.Named WScript.Echo "Named: " & argument Next For Each argument In WScript.Arguments.UnNamed WScript.Echo "UnNamed: " & argument Next
Result (sorry, spanish):
W:\>cscript //nologo test.vbs //test Error de entrada: Opciรณn desconocida "//test" especificada. W:\>cscript //nologo test.vbs // //test /one two argument: //test argument: /one argument: two Named: /test Named: one UnNamed: two W:\>cscript test.vbs // //nologo //test /one two Microsoft (R) Windows Script Host versiรณn 5.812 Copyright (C) Microsoft Corporation. Reservados todos los derechos. argument: //nologo argument: //test argument: /one argument: two Named: /nologo Named: /test Named: one UnNamed: two W:\>
MC ND source share