0

I am trying to make a Batch file that does the following:

  1. cd to a specific directory in my computer.
  2. Enter WSL Ubuntu.
  3. Run a binary file with some arguments.
  4. Close the command prompt terminal.

Ive written a little test batch file. It tries to do the specified actions. The only problem is that once it opens the bash terminal (in the same window) it won't perform the next line until I MANUALLY 'exit' out of WSL and then will try to run the './PESQ' line erroneusly (as it should be).

cd C:/users/jesus/desktop/source/audio
::desired path
bash
::this opens up an ubuntu terminal like session inside CMD
./PESQ
::this is the compiled file, besides, there are more arguments that need to be in that line, (+16000 speech.wav speech_bab_0dB.wav)
pause

When running the code I get the following output

C:\Users\jesus\Desktop\source\audio>bash jesusb@LAPTOP-08IGLCO1:/mnt/c/Users/jesus/Desktop/source/audio$

Once I type exit I get the following output

C:\Users\jesus\Desktop\source\audio>./PESQ
'.' is not recognized as an internal or external command, operable program or batch file.

C:\Users\jesus\Desktop\source\audio>pause
Press any key to continue . . .`

How can I give the ./PESQ +16000 speech.wav speech_bab_0dB.wav command to the bash terminal?

2 Answers 2

1

Instead of using bash, use the wsl command in your batch file:

wsl ./PESQ +16000 speech.wav speech_bab_0dB.wav
Sign up to request clarification or add additional context in comments.

Comments

0

I can add to the already given answer, that if you have several distros within WSL, one can start WSL instance using this Windows command line:

wsl -d Ubuntu-22.04-wsl1 -u petrose --cd "~"

where -d parameter says which instance to start and -u parameter says which user it should start with

Unrelated to above, but may be of interest: Even I had defined my WSL default startup to indicate WSL1, it seems not to affect the instance being started. I did try to use --set-version to say my distro should be an WSL 1 but that command ended with Error 0xd0000022.

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.