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 5971751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:33:40+00:00 2026-05-22T20:33:40+00:00

In Windows what can look for port 8080 and try to kill the process

  • 0

In Windows what can look for port 8080 and try to kill the process it is using through a .BAT file?

  • 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-22T20:33:41+00:00Added an answer on May 22, 2026 at 8:33 pm

    Here’s a command to get you started:

    FOR /F "tokens=4 delims= " %%P IN ('netstat -a -n -o ^| findstr :8080') DO @ECHO TaskKill.exe /PID %%P
    

    When you’re confident in your batch file, remove @ECHO.

    FOR /F "tokens=4 delims= " %%P IN ('netstat -a -n -o ^| findstr :8080') DO TaskKill.exe /PID %%P
    

    Note that you might need to change this slightly for different OS’s. For example, on Windows 7 you might need tokens=5 instead of tokens=4.

    How this works

    FOR /F ... %variable IN ('command') DO otherCommand %variable...
    

    This lets you execute command, and loop over its output. Each line will be stuffed into %variable, and can be expanded out in otherCommand as many times as you like, wherever you like. %variable in actual use can only have a single-letter name, e.g. %V.

    "tokens=4 delims= "
    

    This lets you split up each line by whitespace, and take the 4th chunk in that line, and stuffs it into %variable (in our case, %%P). delims looks empty, but that extra space is actually significant.

    netstat -a -n -o
    

    Just run it and find out. According to the command line help, it “Displays all connections and listening ports.”, “Displays addresses and port numbers in numerical form.”, and “Displays the owning process ID associated with each connection.”. I just used these options since someone else suggested it, and it happened to work 🙂

    ^|
    

    This takes the output of the first command or program (netstat) and passes it onto a second command program (findstr). If you were using this directly on the command line, instead of inside a command string, you would use | instead of ^|.

    findstr :8080
    

    This filters any output that is passed into it, returning only lines that contain :8080.

    TaskKill.exe /PID <value>
    

    This kills a running task, using the process ID.

    %%P instead of %P
    

    This is required in batch files. If you did this on the command prompt, you would use %P instead.

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

Sidebar

Related Questions

In Windows I can post custom message to another process and inform it to
I often have my emacs split into about 4 windows so I can look
A very weird situation... Using the debugger in VS2010 I can look up a
Are there any tools/libraries on Windows that can help me tarck down the culprit?
When trying to debug a program on Windows I can't seem to find where
What windows C IDE can I use that will use gcc to compile and
i'm working on a windows software which can display all the users, groups and
I know on client side (javascript) you can use windows.location.hash but could not find
Looking for an open source web testing tool that can do Windows Authentication. I've
I have a system service running on my Windows machine that can impersonate the

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.