Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
batch programming help reqd
Name: soma.sen Date: August 29, 2007 at 07:12:49 Pacific OS: win2003 CPU/Ram: 1gb Product: intel
Comment:
Hi i am new to batch programming I just need to: 1. start Windows Task Manager inside my batch file 2. list all active processes 3. discover the wanted-processes (check by doing netstat -ano is port no 1099 being used if yes the get the PID and find the name of the process) 4. kill it
Name: Shr0Om Date: August 29, 2007 at 10:00:27 Pacific
Reply:
you can list processes with tasklist in XP. I guess its avaible in w2003 as well.
Anyway.. try this
::CODE @echo off for /f "tokens=1-5 delims= " %%a in ('netstat -o -n ^|find "1099"') do (set PID=%%e call :KillPID)
:KillPID taskkill /f /PID %PID%
0
Response Number 2
Name: ghostdog Date: August 29, 2007 at 19:21:59 Pacific
Reply:
it seems you know what's the process name by using netstat..here's a vbscript to kill process. Its just an example. Don't use svchost.exe in your case [code] strComputer = "." Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _ ("Select * from Win32_Process Where Name = 'svchost.exe'")
For Each objProcess in colProcessList objProcess.Terminate() Next [/code]
0
Response Number 3
Name: Balkrah (by Vaughan Newton) Date: August 31, 2007 at 10:13:27 Pacific
Reply:
Scr0Om: If you used your batch script the 'find' command could output a line with "1099" as the PID, instead of the port. Its unlikely, but anyway to fix this you could use
@echo off setlocal EnableDelayedExpansion for /f "tokens=1-5 delims= " %%a in ('netstat -on ^|find ":1099"') do ( set PID=%%e taskkill /f /PID !PID! )
Summary: I would like help in code for a batch program were it searches for any file in a folder (example xyz.xls), get the name xyz and searches for similar name file in same m/c (for ex: xyz.doc), get the Di...
Summary: Sir, I am in beginning stage of batch programming. And want to know that, when i right click on folder, through batch programming....it takes the name of folder in variable defined in the batch pro...
Summary: Hello all, I am a network admin at my local library and have been requested to have the public computers automatically log off after 60 min to avoid useage abuse. I have posted this question to the NT...