透過命令提示符執行.exe檔案

大多數時候,我們的程式就像我們需要的那樣工作,但偶爾你會遇到一個不太合作的程式,讓你尋找一種方法來解決它的“態度”問題。今天的超級使用者問答有一些很好的建議,可以幫助失意的讀者得到他需要的結果。...

透過命令提示符執行.exe檔案

大多數時候,我們的程式就像我們需要的那樣工作,但偶爾你會遇到一個不太合作的程式,讓你尋找一種方法來解決它的“態度”問題。今天的超級使用者問答有一些很好的建議,可以幫助失意的讀者得到他需要的結果。

今天的問答環節是由SuperUser提供的,SuperUser是Stack Exchange的一個分支,是一個由社群驅動的問答網站分組。

問題

超級使用者閱讀器user418119希望找到一種方法,使程式視窗保持足夠長的開啟時間以檢視結果:

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.

有沒有辦法讓user418119的程式視窗保持開啟足夠長的時間來檢視結果?

答案

超級使用者貢獻者mg30rg、misha256和Ranayna為我們提供了答案。首先,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.

然後是misha256的回答:

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

  • cmd /K “C:\SomeFolder\MyApp.exe”

You can create a shortcut with the above. This solution works with all c***ole 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.

拉納納最後的回答是:

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.


有什麼要補充的解釋嗎?在評論中發出聲音。想從其他精通技術的Stack Exchange使用者那裡瞭解更多答案嗎?在這裡檢視完整的討論主題。

  • 發表於 2021-04-11 00:31
  • 閱讀 ( 35 )
  • 分類:網際網路

你可能感興趣的文章

如何修復Windows10中的“重置電腦時出現問題”錯誤

... 您必須透過Windows命令提示符sfc/scan命令執行系統檔案檢查器。 ...

  • 發佈於 2021-03-28 04:17
  • 閲讀 ( 60 )

如何(以及為什麼)從命令提示符啟動microsoft powerpoint

可以從Windows命令提示符開啟PowerPoint。使用此方法,您可以新增其他引數,這些引數允許您在安全模式下啟動PowerPoint進行故障排除,或者從特定模板開始。 如何使用命令執行powerpoint 從命令提示符開啟PowerPoint有兩種方法,您...

  • 發佈於 2021-03-31 11:12
  • 閲讀 ( 43 )

如何在windows 10的命令提示符下使用microsoft defender antivirus

...體(也稱為WindowsDefender)具有命令列介面。您可以從命令提示符、PowerShell或Windows終端執行Windows 10的內建防病毒軟體,而不是使用圖形化的Windows安全應用程式。 執行快速病毒掃描 您可以執行快速掃描,在某些常見位置(如Wind...

  • 發佈於 2021-03-31 11:39
  • 閲讀 ( 49 )

如何(以及為什麼)從命令提示符啟動microsoft word

像大多數應用程式一樣,您可以從命令提示符啟動Word,但是Word還支援幾個可選的開關來控制啟動過程。 無論您是在提示符處鍵入命令、使用它建立快捷方式、將其作為批處理指令碼的一部分**、使用其他引數啟動Word,都可以...

  • 發佈於 2021-04-03 13:16
  • 閲讀 ( 52 )

如何在Windows10上啟用區分大小寫的檔名和資料夾名

...過fsutil.exe檔案命令,必須從命令列執行。您可以從命令提示符或PowerShell視窗執行此操作。使用預設設定,您在Linux環境中建立的資料夾也會自動配置為區分大小寫。 相關:Windows10新BashShell的所有功能 如何將目錄設定為區分大小...

  • 發佈於 2021-04-05 22:44
  • 閲讀 ( 41 )

如何在Windows10上設定預設的linux發行版

... Linux或WSL執行的Linux發行版。 要執行它,您需要開啟命令提示符或PowerShell視窗。要開啟命令提示視窗,請開啟“開始”選單,鍵入“cmd”,然後單擊“命令提示”快捷方式。要開啟PowerShell視窗,請右鍵單擊“開始”按鈕(或按W...

  • 發佈於 2021-04-06 16:40
  • 閲讀 ( 53 )

如何在vmware中的預分配磁碟和可擴充套件磁碟之間進行轉換

...這個過程在VMWare workstation中要複雜一些,您需要使用命令提示符—VMWare workstation的圖形介面中沒有顯示此選項,因此您必須使用內建的VMWare vdiskmanager命令。 第一步:刪除所有快照 首先,在VMware Workstation中關閉虛擬機器的電源...

  • 發佈於 2021-04-07 13:19
  • 閲讀 ( 90 )

如何縮小virtualbox虛擬機器並釋放磁碟空間

...命令提示視窗。為此,請開啟“開始”選單,搜尋“命令提示符”,然後啟動快捷方式。 更改到包含刪除.exe鍵入cd,按空格鍵,輸入目錄路徑,然後按Enter鍵。如果路徑包含空格字元,請確保用引號將其括起來。應該是這樣...

  • 發佈於 2021-04-07 14:42
  • 閲讀 ( 55 )

如何在virtualbox中轉換固定磁碟和動態磁碟

...機器已“關機” 第一步:找到vboxmanage命令並開啟命令提示符 相關:加速虛擬機器的完整指南 VirtualBox允許您將固定磁碟轉換為動態磁碟,或將動態磁碟轉換為固定磁碟,但此選項未在其圖形介面中公開。相反,你必須使用VBoxM...

  • 發佈於 2021-04-07 14:48
  • 閲讀 ( 122 )

是什麼conhost.exe為什麼它在執行?

...控制檯視窗主機程序需要一點歷史。在windowsxp時代,命令提示符由一個名為ClientServer執行時系統服務(CSRSS)的程序處理。顧名思義,CSRSS是一種系統級服務。這就產生了幾個問題。首先,CSRSS的崩潰可能會導致整個系統癱瘓,這...

  • 發佈於 2021-04-07 18:22
  • 閲讀 ( 30 )
滴蠟狂魔
滴蠟狂魔

0 篇文章

作家榜

  1. admin 0 文章
  2. 孫小欽 0 文章
  3. JVhby0 0 文章
  4. fvpvzrr 0 文章
  5. 0sus8kksc 0 文章
  6. zsfn1903 0 文章
  7. w91395898 0 文章
  8. SuperQueen123 0 文章

相關推薦