Jack
Jack

Reputation: 53

Using a batch file through Linux subsystem on Windows 10?

I have a batch file that bashes into the linux subsystem I have on Windows 10 that tries to execute commands via the linux system. However, it doesn't execute any commands after the bash command. Here is an example:

bash cd Documents/CS/DS

This just bashes into whatever directory the file is run from instead of CS/DS consistently. Is there anyway to have the batch file execute the rest of the commands?

Upvotes: 1

Views: 515

Answers (1)

jwdonahue
jwdonahue

Reputation: 6659

When you run bash like that, you are sending execution into that executable. Launch bash as a separate process:

`start "bash" bash.exe`

Bash won't execute the rest of your cmd script. Cmd.exe processes cmd/bat files, bash only executes bash commands and scripts.

Upvotes: 1

Related Questions