써먹는 웹개발

[RPA] 프로세스 종료 (메모장, 엑셀, ie, 크롬, sap, 폴더)하는 배치파일 본문

Study/RPA

[RPA] 프로세스 종료 (메모장, 엑셀, ie, 크롬, sap, 폴더)하는 배치파일

kmhan 2020. 4. 24. 13:56


728x90
반응형

프로세스 종료 (메모장, 엑셀, ie, 크롬, sap, 폴더)하는 배치파일 만드는 방법 (taskkill)

 - 다음 소스를 텍스트파일에 넣고 확장차를 .bat(배치파일)로 저장

@echo off
tasklist /fi "imagename eq notepad.exe" |find ":" > nul
if errorlevel 1 taskkill /f /im "notepad.exe"

tasklist /fi "imagename eq excel.exe" |find ":" > nul
if errorlevel 1 taskkill /f /im "excel.exe"

tasklist /fi "imagename eq iexplore.exe" |find ":" > nul
if errorlevel 1 taskkill /f /im "iexplore.exe"

tasklist /fi "imagename eq chrome.exe" |find ":" > nul
if errorlevel 1 taskkill /f /im "chrome.exe"

tasklist /fi "imagename eq saplogon.exe" |find ":" > nul
if errorlevel 1 taskkill /f /im "saplogon.exe"

Set VBSFILE=C:\01_Jein\CloseAllOpenedFolders.vbs
(
echo Option Explicit
echo Dim shell,oWindows,j
echo On Error Resume Next
echo set shell = CreateObject("Shell.Application"^)
echo set oWindows = shell.windows
echo for j = oWindows.count - 1 to 0 Step -1
echo   oWindows.item(j^).quit
echo next
echo set j = nothing
echo set shell = nothing
echo set oWindows = nothing
)>%VBSFILE%
Start /Wait %VBSFILE%
728x90
반응형


Comments