In this blog, you will learn how to create your batch file to start and stop the exe and also how to check that file is exist or not.
If you want to create your bat file to start and stop the exe then write your logic on notepad and save it "batchname.bat" and to start an exe file from a batch file in Windows, start command is used for starting the exe from batch.
For example, to start the notepad you can use following command.
START C:\Windows\NOTEPAD.EXE
Here is an all batch file solution (a variation of my other answer) that will zip a file named c:\ue_english.txt and put it in C:\someArchive.zip.
- set FILETOZIP=c:\ue_english.txt
-
- set TEMPDIR=C:\temp738
- rmdir %TEMPDIR%
- mkdir %TEMPDIR%
- xcopy /s %FILETOZIP% %TEMPDIR%
-
- echo Set objArgs = WScript.Arguments > _zipIt.vbs
- echo InputFolder = objArgs(0) >> _zipIt.vbs
- echo ZipFile = objArgs(1) >> _zipIt.vbs
- echo CreateObject("Scripting.FileSystemObject").CreateTextFile(ZipFile, True).Write "PK" ^& Chr(5) ^& Chr(6) ^& String(18, vbNullChar) >> _zipIt.vbs
- echo Set objShell = CreateObject("Shell.Application") >> _zipIt.vbs
- echo Set source = objShell.NameSpace(InputFolder).Items >> _zipIt.vbs
- echo objShell.NameSpace(ZipFile).CopyHere(source) >> _zipIt.vbs
- echo wScript.Sleep 2000 >> _zipIt.vbs
- CScript _zipIt.vbs %TEMPDIR% C:\someArchive.zip
-
- pause
You can use 'taskkill to kill the process. With the /IM parameter, you can specify image names.
Example:
- taskkill /im somecorporateprocess.exe
You can also do this to 'force' kill,
- taskkill /f /im somecorporateprocess.exe
Hope you enjoyed this blog. Thanks for reading.