Windows 7 Command line question

Discussion in 'Programming and Scripting' started by dougie1809, Mar 7, 2012.

  1. dougie1809

    dougie1809 New Member

    Joined:
    Mar 7, 2012
    Messages:
    18
    Likes Received:
    0
    Hi,

    What command can tell me what service has opened what port?
     
  2. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,454
    Likes Received:
    268
    try:

    netstat -a
     
  3. dougie1809

    dougie1809 New Member

    Joined:
    Mar 7, 2012
    Messages:
    18
    Likes Received:
    0
    Ok thanks. And how can I go about killing a task? For an example, I see port 135 being used by epmap, so how can I kill epmap from using port 135?
    Thanks
     
  4. patcooke

    patcooke Microsoft MVP
    Staff Member Premium Supporter Microsoft MVP

    Joined:
    May 16, 2010
    Messages:
    5,454
    Likes Received:
    268
    Use the netstat command with parameters a, o and n:

    netstat -a -o -n

    Note the PID of the service using the port you want to close then go to task manager and end the process with that PID.
     
  5. dougie1809

    dougie1809 New Member

    Joined:
    Mar 7, 2012
    Messages:
    18
    Likes Received:
    0
    Thanks. Or you can actually use the command 'taskkill -f -pid 1024' (PID of epmap). Why is it telling me Access Denied, when trying to kill the process? Í've tried by task manager, and im even in command line adminstrator?
    Thanks
     

Share This Page

Loading...