Skip to content
Advertisement

How can I execute one command from cmd while executing a script in WSL?

I have a build script I’m using in a project I’m currently working on. I found that a certain command only works from cmd and not WSL, but I want to continue to work in WSL.

I have something like this:

command1 && command2 && command3

Say command2 only works in cmd. How can I make this script switch to cmd, execute a command and switch back to WSL?

Advertisement

Answer

You can simply run cmd /c "command2".

The option /c says to read the script from the next command-line argument, rather than from a file or the interactive prompt.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement