How can I make a Windows shortcut that launches Bash and runs commands?Pass cmd.exe arguments via a shortcut?How to solve error: There is no script engine for file extension “.cmd”How to use /k to keep a command prompt shortcut from closing?How to find an 'orphaned' keyboard shortcut that can't be unbound?Make a shortcut to Ubuntu bash.exe on Windows 10 that doesn't auto-closeCreating a Script File to Call a Shortcut That Has a Complex Target and Closing the End Dialog WindowCMD Not Running 2nd Command ( & ) till first program is exitedHow to make a shortcut for VIRTUAL FOLDER from command line in windows 7?Windows File Type Association - Open bat in same powershell windowWindows shortcut, Command Line and Perl

Is there any common country to visit for persons holding UK and Schengen visas?

Showing mass murder in a kid's book

Travelling in US for more than 90 days

How do I lift the insulation blower into the attic?

Output visual diagram of picture

Why is indicated airspeed rather than ground speed used during the takeoff roll?

How would a solely written language work mechanically

How to track Account Description field changes in Field history Tracking?

Index matching algorithm without hash-based data structures?

Reason why a kingside attack is not justified

Derivative of an interpolated function

Can you take a "free object interaction" while incapacitated?

Unfrosted light bulb

Why does the frost depth increase when the surface temperature warms up?

What properties make a magic weapon befit a Rogue more than a DEX-based Fighter?

Can you describe someone as luxurious? As in someone who likes luxurious things?

Strange behavior in TikZ draw command

Magnifying glass in hyperbolic space

Put the phone down / Put down the phone

Error in master's thesis, I do not know what to do

Would this string work as string?

Why do Radio Buttons not fill the entire outer circle?

Why does the Persian emissary display a string of crowned skulls?

Is divisi notation needed for brass or woodwind in an orchestra?



How can I make a Windows shortcut that launches Bash and runs commands?


Pass cmd.exe arguments via a shortcut?How to solve error: There is no script engine for file extension “.cmd”How to use /k to keep a command prompt shortcut from closing?How to find an 'orphaned' keyboard shortcut that can't be unbound?Make a shortcut to Ubuntu bash.exe on Windows 10 that doesn't auto-closeCreating a Script File to Call a Shortcut That Has a Complex Target and Closing the End Dialog WindowCMD Not Running 2nd Command ( & ) till first program is exitedHow to make a shortcut for VIRTUAL FOLDER from command line in windows 7?Windows File Type Association - Open bat in same powershell windowWindows shortcut, Command Line and Perl













3















I've created a windows shortcut with a target that looks like



"C:WindowsSystem32bash.exe" php /c/script.php



(I know I could just use my windows verison of php cli to run this, but out of curiosity)



When I click my shortcut it just pops open a cmd window and closes (where the script should take minutes to run.



Is there a way to pipe commands to bash.exe on windows?










share|improve this question







New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It's simple, just wait and hello world, so i should see something. But the cmd window pops open for a moment and closes.

    – Keith
    Mar 13 at 15:09






  • 1





    Many things I see that are odd about this question. If it were WSL, then "/c/script.php" would be "/mnt/c/script.php".. it it were CYGWIN or MINGW, then bash.exe wouldn't be in Windows/System32. What 'Unix' are you using?

    – Señor CMasMas
    Mar 13 at 15:44
















3















I've created a windows shortcut with a target that looks like



"C:WindowsSystem32bash.exe" php /c/script.php



(I know I could just use my windows verison of php cli to run this, but out of curiosity)



When I click my shortcut it just pops open a cmd window and closes (where the script should take minutes to run.



Is there a way to pipe commands to bash.exe on windows?










share|improve this question







New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • It's simple, just wait and hello world, so i should see something. But the cmd window pops open for a moment and closes.

    – Keith
    Mar 13 at 15:09






  • 1





    Many things I see that are odd about this question. If it were WSL, then "/c/script.php" would be "/mnt/c/script.php".. it it were CYGWIN or MINGW, then bash.exe wouldn't be in Windows/System32. What 'Unix' are you using?

    – Señor CMasMas
    Mar 13 at 15:44














3












3








3








I've created a windows shortcut with a target that looks like



"C:WindowsSystem32bash.exe" php /c/script.php



(I know I could just use my windows verison of php cli to run this, but out of curiosity)



When I click my shortcut it just pops open a cmd window and closes (where the script should take minutes to run.



Is there a way to pipe commands to bash.exe on windows?










share|improve this question







New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I've created a windows shortcut with a target that looks like



"C:WindowsSystem32bash.exe" php /c/script.php



(I know I could just use my windows verison of php cli to run this, but out of curiosity)



When I click my shortcut it just pops open a cmd window and closes (where the script should take minutes to run.



Is there a way to pipe commands to bash.exe on windows?







windows bash cmd.exe shortcuts windows-subsystem-for-linux






share|improve this question







New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Mar 13 at 14:50









KeithKeith

1184




1184




New contributor




Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Keith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • It's simple, just wait and hello world, so i should see something. But the cmd window pops open for a moment and closes.

    – Keith
    Mar 13 at 15:09






  • 1





    Many things I see that are odd about this question. If it were WSL, then "/c/script.php" would be "/mnt/c/script.php".. it it were CYGWIN or MINGW, then bash.exe wouldn't be in Windows/System32. What 'Unix' are you using?

    – Señor CMasMas
    Mar 13 at 15:44


















  • It's simple, just wait and hello world, so i should see something. But the cmd window pops open for a moment and closes.

    – Keith
    Mar 13 at 15:09






  • 1





    Many things I see that are odd about this question. If it were WSL, then "/c/script.php" would be "/mnt/c/script.php".. it it were CYGWIN or MINGW, then bash.exe wouldn't be in Windows/System32. What 'Unix' are you using?

    – Señor CMasMas
    Mar 13 at 15:44

















It's simple, just wait and hello world, so i should see something. But the cmd window pops open for a moment and closes.

– Keith
Mar 13 at 15:09





It's simple, just wait and hello world, so i should see something. But the cmd window pops open for a moment and closes.

– Keith
Mar 13 at 15:09




1




1





Many things I see that are odd about this question. If it were WSL, then "/c/script.php" would be "/mnt/c/script.php".. it it were CYGWIN or MINGW, then bash.exe wouldn't be in Windows/System32. What 'Unix' are you using?

– Señor CMasMas
Mar 13 at 15:44






Many things I see that are odd about this question. If it were WSL, then "/c/script.php" would be "/mnt/c/script.php".. it it were CYGWIN or MINGW, then bash.exe wouldn't be in Windows/System32. What 'Unix' are you using?

– Señor CMasMas
Mar 13 at 15:44











2 Answers
2






active

oldest

votes


















3














If this is WSL, use bash.exe -c "command to run" as in



C:WindowsSystem32bash.exe -c "vi ~/.bashrc"



or



C:WindowsSystem32bash.exe -c "php /mnt/c/script.php"






share|improve this answer























  • Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

    – Keith
    Mar 13 at 17:19











  • Yes I'm aware. afaik I can only accept one answer.

    – Keith
    Mar 13 at 17:48


















1














First of all, bash.exe has been deprecated. You should use wsl.exe in command lines. Use Windows Insiders Builds 17063 and above for the interoperability feature in WSL. For your case, both of this may work:



wsl.exe php /mnt/c/MyFiles/test.php
wsl.exe --exec php /mnt/c/MyFiles/test.php




Here is the wsl.exe usage information:




Usage: wsl.exe [Argument] [Options...] [CommandLine]



Arguments to run Linux binaries:



If no command line is provided, wsl.exe launches the default shell.

--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.

--
Pass the remaining command line as is.



For further details, read WSL interoperabiltity with Windows.








share|improve this answer























  • Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

    – Keith
    Mar 13 at 17:18










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
);



);






Keith is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1413721%2fhow-can-i-make-a-windows-shortcut-that-launches-bash-and-runs-commands%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









3














If this is WSL, use bash.exe -c "command to run" as in



C:WindowsSystem32bash.exe -c "vi ~/.bashrc"



or



C:WindowsSystem32bash.exe -c "php /mnt/c/script.php"






share|improve this answer























  • Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

    – Keith
    Mar 13 at 17:19











  • Yes I'm aware. afaik I can only accept one answer.

    – Keith
    Mar 13 at 17:48















3














If this is WSL, use bash.exe -c "command to run" as in



C:WindowsSystem32bash.exe -c "vi ~/.bashrc"



or



C:WindowsSystem32bash.exe -c "php /mnt/c/script.php"






share|improve this answer























  • Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

    – Keith
    Mar 13 at 17:19











  • Yes I'm aware. afaik I can only accept one answer.

    – Keith
    Mar 13 at 17:48













3












3








3







If this is WSL, use bash.exe -c "command to run" as in



C:WindowsSystem32bash.exe -c "vi ~/.bashrc"



or



C:WindowsSystem32bash.exe -c "php /mnt/c/script.php"






share|improve this answer













If this is WSL, use bash.exe -c "command to run" as in



C:WindowsSystem32bash.exe -c "vi ~/.bashrc"



or



C:WindowsSystem32bash.exe -c "php /mnt/c/script.php"







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 13 at 15:48









Señor CMasMasSeñor CMasMas

1866




1866












  • Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

    – Keith
    Mar 13 at 17:19











  • Yes I'm aware. afaik I can only accept one answer.

    – Keith
    Mar 13 at 17:48

















  • Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

    – Keith
    Mar 13 at 17:19











  • Yes I'm aware. afaik I can only accept one answer.

    – Keith
    Mar 13 at 17:48
















Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

– Keith
Mar 13 at 17:19





Thank you! The -c argument worked great. It was tough to choose which one to accept as answer as they're both great.

– Keith
Mar 13 at 17:19













Yes I'm aware. afaik I can only accept one answer.

– Keith
Mar 13 at 17:48





Yes I'm aware. afaik I can only accept one answer.

– Keith
Mar 13 at 17:48













1














First of all, bash.exe has been deprecated. You should use wsl.exe in command lines. Use Windows Insiders Builds 17063 and above for the interoperability feature in WSL. For your case, both of this may work:



wsl.exe php /mnt/c/MyFiles/test.php
wsl.exe --exec php /mnt/c/MyFiles/test.php




Here is the wsl.exe usage information:




Usage: wsl.exe [Argument] [Options...] [CommandLine]



Arguments to run Linux binaries:



If no command line is provided, wsl.exe launches the default shell.

--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.

--
Pass the remaining command line as is.



For further details, read WSL interoperabiltity with Windows.








share|improve this answer























  • Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

    – Keith
    Mar 13 at 17:18















1














First of all, bash.exe has been deprecated. You should use wsl.exe in command lines. Use Windows Insiders Builds 17063 and above for the interoperability feature in WSL. For your case, both of this may work:



wsl.exe php /mnt/c/MyFiles/test.php
wsl.exe --exec php /mnt/c/MyFiles/test.php




Here is the wsl.exe usage information:




Usage: wsl.exe [Argument] [Options...] [CommandLine]



Arguments to run Linux binaries:



If no command line is provided, wsl.exe launches the default shell.

--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.

--
Pass the remaining command line as is.



For further details, read WSL interoperabiltity with Windows.








share|improve this answer























  • Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

    – Keith
    Mar 13 at 17:18













1












1








1







First of all, bash.exe has been deprecated. You should use wsl.exe in command lines. Use Windows Insiders Builds 17063 and above for the interoperability feature in WSL. For your case, both of this may work:



wsl.exe php /mnt/c/MyFiles/test.php
wsl.exe --exec php /mnt/c/MyFiles/test.php




Here is the wsl.exe usage information:




Usage: wsl.exe [Argument] [Options...] [CommandLine]



Arguments to run Linux binaries:



If no command line is provided, wsl.exe launches the default shell.

--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.

--
Pass the remaining command line as is.



For further details, read WSL interoperabiltity with Windows.








share|improve this answer













First of all, bash.exe has been deprecated. You should use wsl.exe in command lines. Use Windows Insiders Builds 17063 and above for the interoperability feature in WSL. For your case, both of this may work:



wsl.exe php /mnt/c/MyFiles/test.php
wsl.exe --exec php /mnt/c/MyFiles/test.php




Here is the wsl.exe usage information:




Usage: wsl.exe [Argument] [Options...] [CommandLine]



Arguments to run Linux binaries:



If no command line is provided, wsl.exe launches the default shell.

--exec, -e <CommandLine>
Execute the specified command without using the default Linux shell.

--
Pass the remaining command line as is.



For further details, read WSL interoperabiltity with Windows.









share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 13 at 15:57









BiswapriyoBiswapriyo

3,30641344




3,30641344












  • Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

    – Keith
    Mar 13 at 17:18

















  • Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

    – Keith
    Mar 13 at 17:18
















Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

– Keith
Mar 13 at 17:18





Thank you for the heads up about bash.exe's deprecation. I'll use wsl from here on out. And your example worked perfectly, thank you!

– Keith
Mar 13 at 17:18










Keith is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















Keith is a new contributor. Be nice, and check out our Code of Conduct.












Keith is a new contributor. Be nice, and check out our Code of Conduct.











Keith is a new contributor. Be nice, and check out our Code of Conduct.














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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1413721%2fhow-can-i-make-a-windows-shortcut-that-launches-bash-and-runs-commands%23new-answer', 'question_page');

);

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







Popular posts from this blog

Solar Wings Breeze Design and development Specifications (Breeze) References Navigation menu1368-485X"Hang glider: Breeze (Solar Wings)"e

Kathakali Contents Etymology and nomenclature History Repertoire Songs and musical instruments Traditional plays Styles: Sampradayam Training centers and awards Relationship to other dance forms See also Notes References External links Navigation menueThe Illustrated Encyclopedia of Hinduism: A-MSouth Asian Folklore: An EncyclopediaRoutledge International Encyclopedia of Women: Global Women's Issues and KnowledgeKathakali Dance-drama: Where Gods and Demons Come to PlayKathakali Dance-drama: Where Gods and Demons Come to PlayKathakali Dance-drama: Where Gods and Demons Come to Play10.1353/atj.2005.0004The Illustrated Encyclopedia of Hinduism: A-MEncyclopedia of HinduismKathakali Dance-drama: Where Gods and Demons Come to PlaySonic Liturgy: Ritual and Music in Hindu Tradition"The Mirror of Gesture"Kathakali Dance-drama: Where Gods and Demons Come to Play"Kathakali"Indian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceMedieval Indian Literature: An AnthologyThe Oxford Companion to Indian TheatreSouth Asian Folklore: An Encyclopedia : Afghanistan, Bangladesh, India, Nepal, Pakistan, Sri LankaThe Rise of Performance Studies: Rethinking Richard Schechner's Broad SpectrumIndian Theatre: Traditions of PerformanceModern Asian Theatre and Performance 1900-2000Critical Theory and PerformanceBetween Theater and AnthropologyKathakali603847011Indian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceIndian Theatre: Traditions of PerformanceBetween Theater and AnthropologyBetween Theater and AnthropologyNambeesan Smaraka AwardsArchivedThe Cambridge Guide to TheatreRoutledge International Encyclopedia of Women: Global Women's Issues and KnowledgeThe Garland Encyclopedia of World Music: South Asia : the Indian subcontinentThe Ethos of Noh: Actors and Their Art10.2307/1145740By Means of Performance: Intercultural Studies of Theatre and Ritual10.1017/s204912550000100xReconceiving the Renaissance: A Critical ReaderPerformance TheoryListening to Theatre: The Aural Dimension of Beijing Opera10.2307/1146013Kathakali: The Art of the Non-WorldlyOn KathakaliKathakali, the dance theatreThe Kathakali Complex: Performance & StructureKathakali Dance-Drama: Where Gods and Demons Come to Play10.1093/obo/9780195399318-0071Drama and Ritual of Early Hinduism"In the Shadow of Hollywood Orientalism: Authentic East Indian Dancing"10.1080/08949460490274013Sanskrit Play Production in Ancient IndiaIndian Music: History and StructureBharata, the Nāṭyaśāstra233639306Table of Contents2238067286469807Dance In Indian Painting10.2307/32047833204783Kathakali Dance-Theatre: A Visual Narrative of Sacred Indian MimeIndian Classical Dance: The Renaissance and BeyondKathakali: an indigenous art-form of Keralaeee

Urgehal History Discography Band members References External links Navigation menu"Mediateket: Urgehal""Interview with Enzifer of Urgehal, 2007""Urgehal - Interview"Urgehal"Urgehal Frontman Trondr Nefas Dies at 35"Urgehal9042691cb161873230(data)0000 0001 0669 4224no2016126817ee6ccef6-e558-44b6-b059-dbbb5b913b24145036459145036459