Kjører en .exe-fil via kommandoprompt

Innholdsfortegnelse:

Kjører en .exe-fil via kommandoprompt
Kjører en .exe-fil via kommandoprompt

Video: Kjører en .exe-fil via kommandoprompt

Video: Kjører en .exe-fil via kommandoprompt
Video: How to do a Nail Fill Using Kiss Acrylic Kit • Pro Step by Step Tutorial - YouTube 2024, April
Anonim
Mesteparten av tiden våre programmer fungerer akkurat som vi trenger dem til, men hver gang du har en som er mindre enn samarbeidsvillig og lar deg lette etter en måte å fikse sitt holdnings problem på. Dagens SuperUser Q & A-innlegg har noen gode forslag for å hjelpe en frustrert leser å få de resultatene han trenger.
Mesteparten av tiden våre programmer fungerer akkurat som vi trenger dem til, men hver gang du har en som er mindre enn samarbeidsvillig og lar deg lette etter en måte å fikse sitt holdnings problem på. Dagens SuperUser Q & A-innlegg har noen gode forslag for å hjelpe en frustrert leser å få de resultatene han trenger.

Dagens Spørsmål & Svar-sesjon kommer til oss med høflighet av SuperUser-en underavdeling av Stack Exchange, en fellesskapsdrevet gruppering av Q & A-nettsteder.

Spørsmålet

SuperUser-leser user418119 vil finne en måte å holde et programvindu åpent lenge nok til å se resultatene:

I am trying to run an iteration program. Whenever I click on it, it opens then terminates. When I open the input text file using the program, the iteration completes, then the window instantly closes. How can I:

1. Run it so that the window does not close (and I can see my results)

Or

2. Manage to do the same thing via Command Prompt

I am not super familiar with doing stuff via Command Prompt.

Er det mulig å få bruker418119s programvindu til å være åpen lenge nok til å se resultatene?

Svaret

SuperUser bidragsytere mg30rg, misha256 og Ranayna har svaret for oss. Først opp, mg30rg:

You can create a batch file (.bat) containing two lines. The first one is your application’s command line and the second one is “PAUSE”. It will keep the Command Prompt window open until you press a key or close it using the “X” button. The advantage of this solution is that you can have a separate shortcut to the.bat file so that you can either start your program with or without pausing at the finish.

Etterfulgt av svaret fra misha256:

This will leave the Command Prompt window open even after MyApp.exe terminates:

cmd /K “C:SomeFolderMyApp.exe”

You can create a shortcut with the above. This solution works with all console programs and does not require you to go through Command Prompt every time or modify the original.exe file (which you usually cannot).

Incidentally, the /K switch has been around since NT days.

Og vårt siste svar fra Ranayna:

Another way which is quite useful if the path to the.exe file is a complicated one: Open a Command Prompt window and just drag the.exe file into the window. The full path to the.exe file will be pasted into the Command Prompt window and you just have to press Enter. There is no need to cd into any paths.

Har du noe å legge til forklaringen? Lyder av i kommentarene. Vil du lese flere svar fra andre tech-savvy Stack Exchange-brukere? Sjekk ut hele diskusjonstråden her.

Anbefalt: