Computer Hope
Microsoft => Microsoft DOS => Topic started by: crest.boy on December 20, 2010, 11:24:13 PM
-
Hi friends,
I'd like to get a batch script to accept one argument indicating port number and the output of the script is the program name which currently occupies the port. Just like:
input: demo.bat 80
output: firefox.exe
question: what scripts should be implemented in demo.bat?
Could you please do me a favor?
Thanks in advance!!
-
http://www.petefreitag.com/item/77.cfm
-
And that helps how exactly, terrylangley?
-
I'd download and use http://www.mcafee.com/us/downloads/free-tools/fport.aspx (http://www.mcafee.com/us/downloads/free-tools/fport.aspx) FPORT with /a switch (/a sort by application) and pass the Firefox.exe application switch to it, you then can use batch to use the output and parse it as needed to perform other tasks or just >>write_output_to_file.txt in which other programs can read in the txt file and run routines that batch may not be able to perform.
Great link on parsing with batches: http://ss64.com/nt/for_f.html (http://ss64.com/nt/for_f.html)