1.

Solve : My first ever batch file, need help?

Answer» HEY everyone i've got to create a batch file that will attempt to telnet through every port on another computer. Sorry if that sounds stupid but this is my school project. I know i need a for statement that runs 65000 times i guess but i don't know how to do it. Sorry if this sounds pointless check out the FOR command, the /L PARAMETER will do incrementing loops

now go and do your homework !!!
Grahami've tried the for loop but i really don't understand where i would put like the 1-65000 part. My only programming experience is with turing and thats what im used to after i find that i think i can just ECHO "telnet (ip) (variable that is going up from 1-65000)"from the DOS help
FOR /L %variable IN (start,step,end) DO command [command-parameters]

The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)

so something like this
FOR /L %%a IN (1,1,65000) DO telnet (ip) %%a

Let me know if I passednope, when i run it i just get the LINE of code repeated over and over, and the final number is ALWAYS 1ok if i just change it to
FOR /L %%a IN (1,1,65000) DO %%a
it successfully dispays all the numbers so now i have to figure out how to get the "telnet (ip)" part in theregetting closer, i tried
FOR /L %%a IN (1,1,65000) DO TYPE telnet (ip) %%a
and that seemed to work except after each port is CHECKED i get the error
The system cannot find the file specifed.
Error occured while processing: telnet.
The system cannot find the file specifed.
Error occured while processing: (ip).
The system cannot find the file specifed.
Error occured while processing: 129.

Is this because im running the program at home which isn't connected to the network im telnetting, in other words will this work once i running on a computer that's connected to the server?Take out the word "TYPE". If you just want to test it without actually doing the telnet, then use ECHO instead of TYPE.
Code: [Select]FOR /L %%a IN (1,1,65000) DO telnet (ip) %%awhen i take out TYPE the output goes back to only having telnet (ip) 1, it stays at 1 and won't go upok awesome it worked, now once i find a port i have to actually figure out what to do once im in lol thanks for the help guys


Discussion

No Comment Found