[英]Start a program from a batch file and continue with next command
我正在自動啟動IIS Express,然后啟動ngrok並自動打開網頁以瀏覽站點。 不幸的是,我一直處於最后的障礙,因為一旦ngrok啟動了批處理文件的最后一行以打開頁面,直到ngrok進程結束時,它才運行,這顯然不是很有幫助。
例:
ngrok http -subdomain=mysubdomain 192.168.0.2:%port%
:: Pause for 3 seconds as IIS Express takes a moment to start
timeout /t 3
:: launch the browser pointing to this location
start /B "" http://mysubdomain.ngrok.io
如果我更改了啟動ngrok的行(如下所示),那么一切都會按我的意願運行,但是一旦頁面打開,我將無法與ngrok進行交互:
start /B "" ngrok http -subdomain=mysubdomain 192.168.0.2:%port%
我可以在一個批處理文件中實現所需的功能嗎?如果可以,我缺少什么功能? 如果可以的話,我真的很想把這個自我包含和移植到一個批處理文件中。
搶先開始倒計時並隨后啟動瀏覽器。
在同一控制台中:
start /b "" cmd /c timeout /t 3 ^& start /B "" http://mysubdomain.ngrok.io ngrok http -subdomain=mysubdomain 192.168.0.2:%port%
或在單獨的最小化控制台窗口中:
start /min "" cmd /c timeout /t 3 ^& start /B "" http://mysubdomain.ngrok.io ngrok http -subdomain=mysubdomain 192.168.0.2:%port%
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.