Make a shortcut to Ubuntu bash.exe on Windows 10 that doesn't auto-close
I would like to make a shortcut on Windows 10 that opens C:WindowsSystem32bash.exe (Ubuntu on Windows 10), runs a command and doesn't close the terminal.
I made a shortcut with target to C:WindowsSystem32bash.exe -c free
and it runs the "free" command but closes the terminal right after running it. How to prevent it from closing?
Also what would be better: is there a way to load a bash script using such a shortcut (a set of commands located in a text file that such a shortcut would open and execute one after another) without closing the terminal after the execution? I suppose preventing the terminal from closing when running a "target" and a text file would be two separate methods?
windows-10 shortcuts windows-subsystem-for-linux file-shortcut
add a comment |
I would like to make a shortcut on Windows 10 that opens C:WindowsSystem32bash.exe (Ubuntu on Windows 10), runs a command and doesn't close the terminal.
I made a shortcut with target to C:WindowsSystem32bash.exe -c free
and it runs the "free" command but closes the terminal right after running it. How to prevent it from closing?
Also what would be better: is there a way to load a bash script using such a shortcut (a set of commands located in a text file that such a shortcut would open and execute one after another) without closing the terminal after the execution? I suppose preventing the terminal from closing when running a "target" and a text file would be two separate methods?
windows-10 shortcuts windows-subsystem-for-linux file-shortcut
add a comment |
I would like to make a shortcut on Windows 10 that opens C:WindowsSystem32bash.exe (Ubuntu on Windows 10), runs a command and doesn't close the terminal.
I made a shortcut with target to C:WindowsSystem32bash.exe -c free
and it runs the "free" command but closes the terminal right after running it. How to prevent it from closing?
Also what would be better: is there a way to load a bash script using such a shortcut (a set of commands located in a text file that such a shortcut would open and execute one after another) without closing the terminal after the execution? I suppose preventing the terminal from closing when running a "target" and a text file would be two separate methods?
windows-10 shortcuts windows-subsystem-for-linux file-shortcut
I would like to make a shortcut on Windows 10 that opens C:WindowsSystem32bash.exe (Ubuntu on Windows 10), runs a command and doesn't close the terminal.
I made a shortcut with target to C:WindowsSystem32bash.exe -c free
and it runs the "free" command but closes the terminal right after running it. How to prevent it from closing?
Also what would be better: is there a way to load a bash script using such a shortcut (a set of commands located in a text file that such a shortcut would open and execute one after another) without closing the terminal after the execution? I suppose preventing the terminal from closing when running a "target" and a text file would be two separate methods?
windows-10 shortcuts windows-subsystem-for-linux file-shortcut
windows-10 shortcuts windows-subsystem-for-linux file-shortcut
edited Jan 7 at 2:56
phuclv
9,09463890
9,09463890
asked Apr 1 '17 at 15:11
KoamKoam
113
113
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Adding & pause
to the command line might work. I can't test it since I can't run the Linux tools for Windows 10.
Thank you,C:WindowsSystem32bash.exe -c free & pause
didn't work. ButC:WindowsSystem32bash.exe -c free & bash
worked! And withC:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.
– Koam
Apr 1 '17 at 16:40
add a comment |
In this case since you didn't modify any environmental state, you can simply start another bash session like this
C:WindowsSystem32bash.exe -c "free; bash"
or maybe better
C:WindowsSystem32bash.exe -c "free; exec $SHELL"
If environment variables need to be changed then just write the commands in the rc_file and call bash with
C:WindowsSystem32bash.exe --rcfile rc_file
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1194581%2fmake-a-shortcut-to-ubuntu-bash-exe-on-windows-10-that-doesnt-auto-close%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Adding & pause
to the command line might work. I can't test it since I can't run the Linux tools for Windows 10.
Thank you,C:WindowsSystem32bash.exe -c free & pause
didn't work. ButC:WindowsSystem32bash.exe -c free & bash
worked! And withC:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.
– Koam
Apr 1 '17 at 16:40
add a comment |
Adding & pause
to the command line might work. I can't test it since I can't run the Linux tools for Windows 10.
Thank you,C:WindowsSystem32bash.exe -c free & pause
didn't work. ButC:WindowsSystem32bash.exe -c free & bash
worked! And withC:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.
– Koam
Apr 1 '17 at 16:40
add a comment |
Adding & pause
to the command line might work. I can't test it since I can't run the Linux tools for Windows 10.
Adding & pause
to the command line might work. I can't test it since I can't run the Linux tools for Windows 10.
answered Apr 1 '17 at 16:37
boot13boot13
5,19131940
5,19131940
Thank you,C:WindowsSystem32bash.exe -c free & pause
didn't work. ButC:WindowsSystem32bash.exe -c free & bash
worked! And withC:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.
– Koam
Apr 1 '17 at 16:40
add a comment |
Thank you,C:WindowsSystem32bash.exe -c free & pause
didn't work. ButC:WindowsSystem32bash.exe -c free & bash
worked! And withC:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.
– Koam
Apr 1 '17 at 16:40
Thank you,
C:WindowsSystem32bash.exe -c free & pause
didn't work. But C:WindowsSystem32bash.exe -c free & bash
worked! And with C:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.– Koam
Apr 1 '17 at 16:40
Thank you,
C:WindowsSystem32bash.exe -c free & pause
didn't work. But C:WindowsSystem32bash.exe -c free & bash
worked! And with C:WindowsSystem32bash.exe -c free & read
it also works but I can't type further commands.– Koam
Apr 1 '17 at 16:40
add a comment |
In this case since you didn't modify any environmental state, you can simply start another bash session like this
C:WindowsSystem32bash.exe -c "free; bash"
or maybe better
C:WindowsSystem32bash.exe -c "free; exec $SHELL"
If environment variables need to be changed then just write the commands in the rc_file and call bash with
C:WindowsSystem32bash.exe --rcfile rc_file
add a comment |
In this case since you didn't modify any environmental state, you can simply start another bash session like this
C:WindowsSystem32bash.exe -c "free; bash"
or maybe better
C:WindowsSystem32bash.exe -c "free; exec $SHELL"
If environment variables need to be changed then just write the commands in the rc_file and call bash with
C:WindowsSystem32bash.exe --rcfile rc_file
add a comment |
In this case since you didn't modify any environmental state, you can simply start another bash session like this
C:WindowsSystem32bash.exe -c "free; bash"
or maybe better
C:WindowsSystem32bash.exe -c "free; exec $SHELL"
If environment variables need to be changed then just write the commands in the rc_file and call bash with
C:WindowsSystem32bash.exe --rcfile rc_file
In this case since you didn't modify any environmental state, you can simply start another bash session like this
C:WindowsSystem32bash.exe -c "free; bash"
or maybe better
C:WindowsSystem32bash.exe -c "free; exec $SHELL"
If environment variables need to be changed then just write the commands in the rc_file and call bash with
C:WindowsSystem32bash.exe --rcfile rc_file
answered Jan 6 at 14:27
phuclvphuclv
9,09463890
9,09463890
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1194581%2fmake-a-shortcut-to-ubuntu-bash-exe-on-windows-10-that-doesnt-auto-close%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown