0

I am currently attempting to launch a different console (.exe) and pass multiple commands; while starting and entering a command works just fine, I haven't been able to find out how multiple ones can be entered via powershell.

& "C:\Program Files\Docker Toolbox\start.sh" docker-compose up -d --build

The given command works fine, but as mentioned I need to pass more than one command - I tried using arrays, ScriptBlocks and different sequences, though to no avail.

Edit:

Noticed that the docker build has a -f tag which allows me to specify a file; however, the issue now seems to be that the executed cmd removes all backslashes & special characters, rendering the path given useless.

Example:

&"C:\Program Files\Docker Toolbox\start.sh" 'docker-compose build -f 
path\to\dockerfile'

will result in an error stating that "pathtodockerfile" is an invalid path.

2 Answers 2

0

Your start.sh needs to be able to handle multiple arguments. This doesn't look like a PowerShell question

Sign up to request clarification or add additional context in comments.

8 Comments

How'd I find out? start.sh is the file provided by Docker, and I have to run it as it configures all necessary proxy & VM settings.
@AscendedKitten Try quoting the arguments as a single string. & 'C:\Program Files\Docker Toolbox\start.sh' 'docker-compose up -d --build'
the arguments aren't the issue, as they are recognized - the issue lies in executing multiple commands, since I need to navigate to the right directory using cd before using docker-compose.
@AscendedKitten So you're trying to use PowerShell to send commands to a different program's console?
Exactly. Basically the rest of the script downloads some stuff, and in the end calls the program that actually processes that data. Though I do need more than one command to initialize that.
|
0

Turns out that it was easier than expected; Solved it by executing a seperate file that contained the two commands needed and passing it to the start.sh file.

&"C:\Program Files\Docker Toolbox\start.sh" './xyz/fileContainingCommands.sh'

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.