Помогите «перевести» код из cmd в gitbash! Вот мой код:
@echo off
setlocal enableextensions enabledelayedexpansion
cd c:\windows\system32
set iCount=%~1
if defined iCount (
for /l %%i in (1, 1, %iCount%) do (
for /f "usebackq delims=" %%j in (`wmic.exe Process call Create "notepad.exe" ^| find.exe /i "ProcessId"`) do for /f "tokens=2 delims==; " %%k in ("%%j") do (
set sProcessID%%i=%%~k
)
)
set sProcessID
pause
set /a iCount -= 1
for /l %%i in (1, 1, !iCount!) do (
>nul wmic.exe Process where "ProcessID='!sProcessID%%i!'" call Terminate 0
)
) else (
echo Usage: %~nx0 ^<Count^>
exit /b 1
)
endlocal
exit /b 0