1

I would like to run file.bat with parameters through a vbscript like this:

Function RunMove()
wshShell.Run("file.bat goto X")
End Function
Gerhard
  • 22,678
  • 7
  • 27
  • 43
  • 3
    You'll need to get the stdin inside of the batch file. Create a function for it in the batch-file itself. – Gerhard Jan 12 '22 at 15:57

1 Answers1

1

You need to create a function inside your batch-file as a macro to do something with parameters from stdin, if received. You posted no batch code, so here is a dummy example:

@echo off
If "%3" == "" if not "%2" == "" if /i "%1" == "goto" %*
goto :eof
:X
echo You requested 'goto :loop'

So in this case in the example you gave, if you run file.bat goto X it will reach use the macro to reach that label.

Gerhard
  • 22,678
  • 7
  • 27
  • 43