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 $*

1 Answer 1

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 %*
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.