Hei, I want to start the bash.exe on windows with start parameters, and let the shell open. I found the msdn page for this, but if I try to run it with e.g. bash -c "ls" , the bash is already closed after.
I want to have a link on my desktop where I put in a login command for ssh. So the shell should stay open, and not perfom the command then exit.
Press Windows key + X then click Command prompt, at the command prompt, type: bash then hit Enter. If you want to be able to access the local file system, press Windows key + X, Command Prompt (Admin) then type bash at the prompt.
1] Execute Shell Script file using WSLScroll to find WSL, check the box, and then install it. Once done, one has to reboot to finish installing the requested changes. Press Restart now. BASH will be available in the Command Prompt and PowerShell.
From man bash
-c If the -c option is present, then commands are read from the first non-option
argument command_string. If there are arguments after the command_string,
they are assigned to the positional parameters, starting with $0.
So, with -c
, the shell is not interactive. If you want an interactive shell after the initial command is run, start another interactive bash shell from running bash shell.
With your example, it will be:
bash -c 'ls; exec bash'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With