Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:26:53+00:00 2026-05-26T08:26:53+00:00

I want to write a batch file that updates a DLL that is in

  • 0

I want to write a batch file that updates a DLL that is in use by a running process, a regular application.

To do this, the plan is to stop the process, copy the DLL to the required location, then restart the process.

I know I can try to kill a process with taskkill. How can I make sure the process has fallen over and died, after I shoot it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:26:54+00:00Added an answer on May 26, 2026 at 8:26 am

    Here’s what I used. It’s a subroutine in a batch file.

    set tasklist=%windir%\System32\tasklist.exe
    set taskkill=%windir%\System32\taskkill.exe
    
    -------------------------------------------------------
    :STOPPROC
        set wasStopped=0
        set procFound=0
        set notFound_result=ERROR:
        set procName=%1
        for /f "usebackq" %%A in (`%taskkill% /IM %procName%`) do (
          if NOT %%A==%notFound_result% (set procFound=1)
        )
        if %procFound%==0 (
          echo The process was not running.
          goto :EOF
        )
        set wasStopped=1
        set ignore_result=INFO:
    :CHECKDEAD
        "%windir%\system32\timeout.exe" 3 /NOBREAK
        for /f "usebackq" %%A in (`%tasklist% /nh /fi "imagename eq %procName%"`) do (
          if not %%A==%ignore_result% (goto :CHECKDEAD)
        )
        goto :EOF
    -------------------------------------------------------
    

    To use it from within a batch file, do like this:

      call :STOPPROC notepad.exe
    

    Full example:

    set tasklist=%windir%\System32\tasklist.exe
    set taskkill=%windir%\System32\taskkill.exe
    
    -------------------------------------------------------
    :STOPPROC
        set wasStopped=0
        set procFound=0
        set notFound_result=ERROR:
        set procName=%1
        for /f "usebackq" %%A in (`%taskkill% /IM %procName%`) do (
          if NOT %%A==%notFound_result% (set procFound=1)
        )
        if %procFound%==0 (
          echo The process was not running.
          goto :EOF
        )
        set wasStopped=1
        set ignore_result=INFO:
    :CHECKDEAD
        "%windir%\system32\timeout.exe" 3 /NOBREAK
        for /f "usebackq" %%A in (`%tasklist% /nh /fi "imagename eq %procName%"`) do (
          if not %%A==%ignore_result% (goto :CHECKDEAD)
        )
        goto :EOF
    -------------------------------------------------------
    
    :MAIN 
    
    call :STOPPROC notepad.exe
    call :STOPPROC Skype.exe
    

    You’ll notice lines that have all dashes – that’s not a legal syntax for a batch file of course. But, those lines are never reached, because of the use of GOTO statements, so the syntax is never evaluated. Therefore those lines aren’t a problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to write a batch file that will take the contents of a
I want to write a batch file that performs the following operations: Check if
I want to write batch file for my own php framework. for example i
I want to write a word addin that does some computations and updates some
HI i want to implement this C code in batch file int i; scanf(%d,
i want to create a batch file that executes command in it every 1
In my batch file I want to pass multiple parameters to some other application.
I want to start a process with a batch file and if it returns
I need to either write a batch file or a vbscript that will rename
I want to make a batch file, that would make me happy a long

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.