Solved .bat file, batch coding simple variable use

Skylais

Closed as requested
Local time
7:55 AM
Messages
614
Location
Houston, Texas
Code:
@echo off
color C
SET IPaddress=0
set /p IPaddress=Please enter the destination Ip Address:
color A
ping IPaddress
pause
okay, so i want the IPaddress variable to be used as the ipaddress to be pinged. When i run this, it is ineffective. Can someone teach me as why and how to properly code this?

Actually i just figured out how to reference the variable with modulus/percentage symbols.
%IPaddress%
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo Y560 Laptop
OS
Microsoft Windows 7 Ultimate 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i7 CPU Q [email protected] (Turbo boost 2.93ghz)
Motherboard
Lenovo KL3
Memory
4.00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5730
Sound Card
(1) ATI HDMI Audio (2) Realtek High Definition Audio
Monitor(s) Displays
1024 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-24A0RT0
Mouse
Logitech M305
Internet Speed
10 Mbps
Antivirus
My brain
Browser
Google Chrome
Other Info
Trying my best to learn.
~~~
Actually i just figured out how to reference the variable with modulus/percentage symbols.
%IPaddress%

Does this mean that you no longer need help?

You might also want to make the batch file loop back to the start.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Actually do you mind showing me a basis on such a loop. Also if you know anywhere i could learn this simple type of batch coding, could you please link me to it
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo Y560 Laptop
OS
Microsoft Windows 7 Ultimate 64-bit 7601 Multiprocessor Free Service Pack 1
CPU
Intel(R) Core(TM) i7 CPU Q [email protected] (Turbo boost 2.93ghz)
Motherboard
Lenovo KL3
Memory
4.00 GB
Graphics Card(s)
ATI Mobility Radeon HD 5730
Sound Card
(1) ATI HDMI Audio (2) Realtek High Definition Audio
Monitor(s) Displays
1024 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Screen Resolution
1366 x 768 x 32 bits (4294967296 colors) @ 60 Hz
Hard Drives
WDC WD5000BEVT-24A0RT0
Mouse
Logitech M305
Internet Speed
10 Mbps
Antivirus
My brain
Browser
Google Chrome
Other Info
Trying my best to learn.
Here is a loop that I use:

Code:
:start
ipconfig/all
pause
goto start
For the ping batch file in your post, you might also want to tell the user how to enable quick edit so that they can quickly paste the IP address in... as opposed to typing it in or using the slower/default paste. Right click on the title bar of an open cmd window - then select properties - and look around.

Try this website:
Getting started with batch files

edit: there is not a space between ipconfig and the switch /all.
That space is optional. I tend not to put it there.
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
Back
Top