Announcement

Collapse
No announcement yet.

Script found here not working

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script found here not working

    I got the following script here and it works at the command line after strong typing it, but the same text in a .bat file I get an error returned "i not expected at this time"

    for /l %i in (1,1,255) do ping -n 1 172.16.0.%i | find /i "Reply">>c:\ipaddresses.txt

    I have several closed networks here where a batch file could save me a LOT of time, might anyone know how to fix the command line text so that it works in a batch file?


    TIA,

    Gary

  • #2
    Re: Script found here not working

    I think where you have %i you need %1
    Server 2000 MCP
    Development: ASP, ASP.Net, PHP, VB, VB.Net, MySQL, MSSQL - Check out my blog http://tonyyeb.blogspot.com

    ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

    Comment


    • #3
      Re: Script found here not working

      Originally posted by tonyyeb
      I think where you have %i you need %1
      With %i at the command line it works, in a batch file it gives the error.

      "i was unexpected at this time"

      If I use %1 I get the error:

      "in was unexpected at this time"

      As I said, the commands work as originally posted strong typed, but NOT in a .bat file.


      Gary

      Comment


      • #4
        Re: Script found here not working

        try in bat:

        Code:
        for /l %%i in (1,1,255) do ping -n 1 172.16.0.%%i | find /i "Reply">>c:\ipaddresses.txt
        instead of:

        Code:
        for /l %i in (1,1,255) do ping -n 1 172.16.0.%i | find /i "Reply">>c:\ipaddresses.txt
        Marcel
        Technical Consultant
        Netherlands
        http://www.phetios.com
        http://blog.nessus.nl

        MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
        "No matter how secure, there is always the human factor."

        "Enjoy life today, tomorrow may never come."
        "If you're going through hell, keep going. ~Winston Churchill"

        Comment

        Working...
        X