Programming in CMD

Geekpower2000

New Member
Just to give you guys an idea of what I am trying to do. I want to make some simple programs using Command Prompt in Windows Vista. No, this is not a problem I am having with the OS. What I am trying to do, is to write a simple program that allows me to run IPCONFIG test for whatever computer this program is on. However, I need to know if there is a way to capture the IP address of the computer. So that it can be retrieved by the program and used to ping the local machine of the system?
 

My Computer

System One

  • Manufacturer/Model
    Dell 1535 Studio
There are third party apps that can do it, but not a really reliable way (AFAIK) o capture the *external* IP of the system.

Then again, I don't do this often, and I may be way off base....
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro X64 Insider Preview (Skip Ahead) latest build
    Manufacturer/Model
    The Beast Model V (homebrew)
    CPU
    Intel Core i7 965 EE @ 3.6 GHz
    Motherboard
    eVGA X58 Classified 3 (141-GT-E770-A1)
    Memory
    3 * Mushkin 998981 Redline Enhanced triple channel DDR3 4 GB CL7 DDR3 1600 MHz (PC3-12800)
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek HD Audio (onboard)
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen
    Screen Resolution
    2 * 1920 x 1080
    Hard Drives
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD (System)
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD (User Tree)
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM SATA II Mech. HD
    Seagate ST1500DL001-9VT15L Barracuda 7200.12 1.5 TB S
    PSU
    Thermaltake Black Widow TX TR2 850W 80+ Bronze Semi-Mod ATX
    Case
    ThermalTake Level 10 GT (Black)
    Cooling
    Corsair H100 (CPU, dual 140 mm fans on radiator) + Air (2 *
    Keyboard
    Logitech G15 (gen 2)
    Mouse
    Logitech MX Master (shared)
    Internet Speed
    AT&T Lightspeed Gigabit duplex
  • Operating System
    Sabayon Linux (current, weekly updates, 5.1.x kernel)
    Manufacturer/Model
    Lenovo ThinkPad E545
    CPU
    AMD A6-5350M APU
    Motherboard
    Lenovo
    Memory
    8 GB
    Graphics card(s)
    Radeon HD (Embedded)
    Sound Card
    Conextant 20671 SmartAudio HD
    Monitor(s) Displays
    Lenovo 15" Matte
    Screen Resolution
    1680 * 1050
    Hard Drives
    INTEL Cherryvill 520 Series SSDSC2CW180A 180 GB SSD
    PSU
    Lenovo
    Case
    Lenovo
    Cooling
    Lenovo
    Mouse
    Logitech MX Master (shared) | Synaptics TouchPad
    Keyboard
    Lenovo
    Internet Speed
    AT&T LightSpeed Gigabit Duplex
Just to give you guys an idea of what I am trying to do. I want to make some simple programs using Command Prompt in Windows Vista. No, this is not a problem I am having with the OS. What I am trying to do, is to write a simple program that allows me to run IPCONFIG test for whatever computer this program is on. However, I need to know if there is a way to capture the IP address of the computer.

Use those code and save with the extension .vbs
Code:
strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colAdapters = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
 
n = 1
 
For Each objAdapter in colAdapters
   
   
 
   If Not IsNull(objAdapter.IPAddress) Then
      For i = 0 To UBound(objAdapter.IPAddress)
     WScript.Echo "  Your Local IP address is: " & objAdapter.IPAddress(i)
      Next
   End If
 
   n = n + 1
 
Next

Function WMIDateStringToDate(utcDate)
   WMIDateStringToDate = CDate(Mid(utcDate, 5, 2)  & "/" & _
       Mid(utcDate, 7, 2)  & "/" & _
           Left(utcDate, 4)    & " " & _
               Mid (utcDate, 9, 2) & ":" & _
                   Mid(utcDate, 11, 2) & ":" & _
                      Mid(utcDate, 13, 2)) 

End Function

So that it can be retrieved by the program and used to ping the local machine of the system?

You comepletely lost me at this part.
 

My Computer

As for where I lost you. There is a truncated version of the command prompt in Windows Vista. What I am trying to do is simply this.

When I start the program it runs the ip configuration test for you. So what you have is this. In the program it has a line of command that brings up your ip configuration information. Then grabs your IP from the local machine, and pings the IP address. So, it would look something lik this.

ipconfig /all
(program grabs the IP address of the local machine)
ping ooo.ooo.oo.o (program has pinged the IP address through the command prompt and pings it.)

I hope this makes things a little more clear. If I have lost you then I can attempt to tell you what it is.
 

My Computer

System One

  • Manufacturer/Model
    Dell 1535 Studio
Ok this is what is confusing me, it sounds like you are running the program on a local machine and then trying to ping its own address.
 

My Computer

Pretty much. I am trying to write a program that will grab the ip address as a variable, then ping that address automaticly.
 

My Computer

System One

  • Manufacturer/Model
    Dell 1535 Studio
I am currantly a student at a private IT college. I am trying to do simple programming as it relates to a class I am currantly taking.
What I wanted to do was to make a program that runs an IP test to test home network connections, then gives you the simple information that any tech would use to diagnose network issues. Including ping rate, timing issues, DNS resolution issues, and so forth, ect ect.
 

My Computer

System One

  • Manufacturer/Model
    Dell 1535 Studio
You might could look into Windows Power Shell - it is much more robust and will probably suit your needs.
 

My Computers

System One System Two

  • Operating System
    Windows 10 Pro X64 Insider Preview (Skip Ahead) latest build
    Manufacturer/Model
    The Beast Model V (homebrew)
    CPU
    Intel Core i7 965 EE @ 3.6 GHz
    Motherboard
    eVGA X58 Classified 3 (141-GT-E770-A1)
    Memory
    3 * Mushkin 998981 Redline Enhanced triple channel DDR3 4 GB CL7 DDR3 1600 MHz (PC3-12800)
    Graphics Card(s)
    eVGA GeForce GTX 970 SSC ACX 2.0 (04G-P4-3979-KB)
    Sound Card
    Realtek HD Audio (onboard)
    Monitor(s) Displays
    2 * Lenovo LT2323pwA Widescreeen
    Screen Resolution
    2 * 1920 x 1080
    Hard Drives
    SanDisk Ultra SDSSDHII-960G-G25 960 GB SATA III SSD (System)
    Crucial MX100 CT256MX100SSD1 256GB SATA III SSD (User Tree)
    2 * Seagate Barracuda 7200.12 ST31000528AS 1TB 7200 RPM SATA II Mech. HD
    Seagate ST1500DL001-9VT15L Barracuda 7200.12 1.5 TB S
    PSU
    Thermaltake Black Widow TX TR2 850W 80+ Bronze Semi-Mod ATX
    Case
    ThermalTake Level 10 GT (Black)
    Cooling
    Corsair H100 (CPU, dual 140 mm fans on radiator) + Air (2 *
    Keyboard
    Logitech G15 (gen 2)
    Mouse
    Logitech MX Master (shared)
    Internet Speed
    AT&T Lightspeed Gigabit duplex
  • Operating System
    Sabayon Linux (current, weekly updates, 5.1.x kernel)
    Manufacturer/Model
    Lenovo ThinkPad E545
    CPU
    AMD A6-5350M APU
    Motherboard
    Lenovo
    Memory
    8 GB
    Graphics card(s)
    Radeon HD (Embedded)
    Sound Card
    Conextant 20671 SmartAudio HD
    Monitor(s) Displays
    Lenovo 15" Matte
    Screen Resolution
    1680 * 1050
    Hard Drives
    INTEL Cherryvill 520 Series SSDSC2CW180A 180 GB SSD
    PSU
    Lenovo
    Case
    Lenovo
    Cooling
    Lenovo
    Mouse
    Logitech MX Master (shared) | Synaptics TouchPad
    Keyboard
    Lenovo
    Internet Speed
    AT&T LightSpeed Gigabit Duplex
Back
Top