[英]Looking for Unix style 'getopt' command line parsing in a Windows batch file
[英]emulate unix 'cut' using standard windows command line/batch commands
有沒有辦法在Windows XP上模擬unix cut命令,而不使用cygwin或其他非標准的Windows功能?
示例:使用tasklist / v,通過窗口標題查找特定任務,然后從該列表中提取PID以傳遞給taskkill。
僅供參考,任務列表和taskkill已具備過濾功能:
tasklist /FI "imagename eq chrome.exe"
taskkill /F /FI "imagename eq iexplore.exe"
如果您想要更多通用功能,批處理腳本(ugh)可以提供幫助。 例如:
for /f "tokens=1,2 delims= " %%i in ('tasklist /v') do (
if "%%i" == "%~1" (
echo TASKKILL /PID %%j
)
)
windows命令行有相當多的幫助。 鍵入“help”以獲取帶有簡單摘要的命令列表,然后鍵入“help”以獲取有關該命令的更多信息(例如“help for”)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.