0

My use case: having a repl executable scala.bat which takes some arguments, one of which allows pointing it to a configuration file which is ran on start. I renamed scala.bat to scala-original.bat and called scala-original.bat from inside scala.bat:

@echo off

scala-original.bat -i C:\Progra~2\scala\bin\test-config.scala

How can I pass the original arguments scala.bat was called with to scala-original.bat? They should be added at the end of:

scala-original.bat -i C:\Progra~2\scala\bin\test-config.scala

For example, calling:

scala.bat -nc

should run:

scala-original.bat -i C:\Progra~2\scala\bin\test-config.scala -nc

We can ignore double specifying the -i part again for now.

For my use case, using an alias could also be a solution as seen in https://stackoverflow.com/a/21040825/750216 , eg.:

@echo off
doskey scala=scala-original.bat -i C:\Progra~2\scala\bin\test-config.scala $*
Community
  • 1
  • 1
Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169

1 Answers1

1

%* is "all parameters to me (the currently running batchfile)". (Try echo %* in a batchfile). That makes it very easy to pass them to the next batchfile:

scala-original.bat -i C:\Progra~2\scala\bin\test-config.scala %*
Stephan
  • 53,940
  • 10
  • 58
  • 91