Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help with getting batch to a txt file  (Read 2193 times)

0 Members and 1 Guest are viewing this topic.

jcoulter7

  • Guest
Help with getting batch to a txt file
« on: January 31, 2007, 07:57:58 PM »
Hi I want to use a batch script to copy my IP address and save it in a txt file.  Is there anyway I could do that through dos?  It would really help if somebody could help me.  Thank you.

fffreak



    Adviser

  • That's right I am a final fantasy freak.
  • Thanked: 3
    • Yes
    • JSPCRepair
  • Certifications: List
  • Experience: Guru
  • OS: Windows 7
Re: Help with getting batch to a txt file
« Reply #1 on: February 01, 2007, 06:59:57 AM »
Easy here ya go ;)!

Code: [Select]
ipconfig>> ipaddress.txt
Computers are the future, not us. Learn everything you can about them while you still can, soon they will be learning about us... Every bit of advice that I give you is best guess, it is your choice whether or not you listen to it.

jcoulter7

  • Guest
Re: Help with getting batch to a txt file
« Reply #2 on: February 01, 2007, 07:02:34 AM »
Oh my gosh thank you so much you are a life saver!  :D

fffreak



    Adviser

  • That's right I am a final fantasy freak.
  • Thanked: 3
    • Yes
    • JSPCRepair
  • Certifications: List
  • Experience: Guru
  • OS: Windows 7
Re: Help with getting batch to a txt file
« Reply #3 on: February 01, 2007, 07:05:04 AM »
Your welcome, always happy to help. But may I ask why you needed that, just asking?

 8-)fffreak
Computers are the future, not us. Learn everything you can about them while you still can, soon they will be learning about us... Every bit of advice that I give you is best guess, it is your choice whether or not you listen to it.

ghostdog74



    Specialist

    Thanked: 27
    Re: Help with getting batch to a txt file
    « Reply #4 on: February 01, 2007, 05:58:49 PM »
    just get IP addresses
    Code: [Select]
    @echo off
    ::
    :: get all IP addresses and assign to IPaddr1, IPaddr2, etc.
    ::
    set ctr=0
    for /f "tokens=2 delims=:" %%a in (
     'ipconfig ^|find "IP Address"'
     ) do call :saveIP %%a
    for /l %%a in (1,1,%ctr%) do call :showIP %%a
     goto :EOF

    :showIP
    call :exec echo IP Address %1 is %%IPaddr%1%%%
    goto :EOF

    :saveIP
    set /a ctr+=1
    set IPaddr%ctr%=%1
    goto :EOF
    :exec
    %*
    goto :EOF
    EOF