Windows Command Prompt:
Open multiple command prompt in one go:
start cmd DIRECTORY1
start cmd DIRECTORY2
Start multiple processes in one go:
start java -jar DIRECTORY1\target\zipkin-service-1-0.0.1-SNAPSHOT.jar
start java -jar DIRECTORY2\target\zipkin-service-2-0.0.1-SNAPSHOT.jar
Find and Kill multiple processes in one go (8081, 8082 are port numbers where server is running):
FOR /F "tokens=5 delims= " %%P IN ('netstat -a -n -o ^| findstr :8081') DO TaskKill.exe /PID %%P
FOR /F "tokens=5 delims= " %%P IN ('netstat -a -n -o ^| findstr :8082') DO TaskKill.exe /PID %%P
Showing posts with label Windows Command. Show all posts
Showing posts with label Windows Command. Show all posts
Friday, February 19, 2021
Windows commands to start and stop multiple processes
Thursday, August 4, 2016
Search a string in a file or recursively in a directory in windows. For Unix, shell scripting is awesome but windows
we always curse Microsoft. But we too have command prompt too.
Below program will search a string in a directory (all files recursively). Copy the code in a file called "LogSearch.bat".
And run as below, this will give all the file names where WARNING_MESSAGE is present.
LogSearch.bat WARNING_MESSAGE D:\server_logs\
-------------------------------------------------------------
@echo off
echo 'Enter_String_To_Search Directory_Name_To_Search'
set arg1=%1
set arg2=%2
setlocal
pushd %arg2%
findstr /s /m %arg1% *
popd
endlocal
-------------------------------------------------------------
we always curse Microsoft. But we too have command prompt too.
Below program will search a string in a directory (all files recursively). Copy the code in a file called "LogSearch.bat".
And run as below, this will give all the file names where WARNING_MESSAGE is present.
LogSearch.bat WARNING_MESSAGE D:\server_logs\
-------------------------------------------------------------
@echo off
echo 'Enter_String_To_Search Directory_Name_To_Search'
set arg1=%1
set arg2=%2
setlocal
pushd %arg2%
findstr /s /m %arg1% *
popd
endlocal
-------------------------------------------------------------
Subscribe to:
Posts (Atom)