Solved Determine if a network computer is online from a batch file

jsquareg

New member
Power User
Local time
7:46 AM
Messages
400
Under Win 7 I have a batch file in which I want to include an If Exist statement to determine if a specific Network computer is on the network. I thought something like this would work but I keep getting an invalid path error.

If exist \\HP-Laptop\\ 'do a little something'

Will some please help me out?

Thank you.
 

My Computer My Computer

At a glance

Windows 7 Home Premium (Retail) Full version ...3.10 Gig Intel Core i5-3350P8192 Megabytes Usable Installed Memory
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell XPS-8500
OS
Windows 7 Home Premium (Retail) Full version - With SP1
CPU
3.10 Gig Intel Core i5-3350P
Motherboard
Dell 0NW73C A00
Memory
8192 Megabytes Usable Installed Memory
Monitor(s) Displays
Samsung SyncMaster [Monitor] (19.1"vis, s/n HVELA10194, Octo
Screen Resolution
1024 X 768
Hard Drives
INTEL SSDSA2CW120G3 ATA Device [Hard drive] (120.03 GB)
INTEL SSDSA2CW080G3 ATA Device [Hard drive] (80.02 GB)
Keyboard
HID Keyboard Device (HP)
Mouse
Dell (came with computer)
Internet Speed
cox high speed
Other Info
The above taken with Bel Arc Advisor
Under Windows 7, is it possible to determine if a specific computer is logged in to a network? If so, how?

Thank you.
 

My Computer My Computer

At a glance

Windows 7 Home Premium (Retail) Full version ...3.10 Gig Intel Core i5-3350P8192 Megabytes Usable Installed Memory
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell XPS-8500
OS
Windows 7 Home Premium (Retail) Full version - With SP1
CPU
3.10 Gig Intel Core i5-3350P
Motherboard
Dell 0NW73C A00
Memory
8192 Megabytes Usable Installed Memory
Monitor(s) Displays
Samsung SyncMaster [Monitor] (19.1"vis, s/n HVELA10194, Octo
Screen Resolution
1024 X 768
Hard Drives
INTEL SSDSA2CW120G3 ATA Device [Hard drive] (120.03 GB)
INTEL SSDSA2CW080G3 ATA Device [Hard drive] (80.02 GB)
Keyboard
HID Keyboard Device (HP)
Mouse
Dell (came with computer)
Internet Speed
cox high speed
Other Info
The above taken with Bel Arc Advisor
You mean if some other computer is connected and turned on?

If so, the easiest way is to simply ping it, if it replies it's online. If it fails, it's either powered off, or firewalled (by default Windows allows pings from anyone).
You can also use that in bat files, and use the returned errorlevel value for further actions.
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64Intel Core i7-740QM8 GB DDR3NVIDIA GeForce 330GT
Computer type
Laptop
Computer Manufacturer/Model Number
Toshiba Sattelite A665-S6092
OS
Windows 7 Ultimate x64
CPU
Intel Core i7-740QM
Memory
8 GB DDR3
Graphics Card(s)
NVIDIA GeForce 330GT
Screen Resolution
1366x768
Hard Drives
Samsung 840 SSD 500GB
1TB USB3 external HD
Cooling
Coolermaster Notepal U3 notebook cooling pad
Internet Speed
3mbps ASDL
Antivirus
ClamWin 0.98.7
Browser
Opera 12.17 x86 (main), Firefox 38 (sec), IE11 (last resort)
You mean if some other computer is connected and turned on?

If so, the easiest way is to simply ping it, if it replies it's online. If it fails, it's either powered off, or firewalled (by default Windows allows pings from anyone).
You can also use that in bat files, and use the returned errorlevel value for further actions.

Yes, That is exactly what I should have said. It has been ages since I have pinged something so I will have to dust off my memory bank.

Thanks so much.
 

My Computer My Computer

At a glance

Windows 7 Home Premium (Retail) Full version ...3.10 Gig Intel Core i5-3350P8192 Megabytes Usable Installed Memory
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell XPS-8500
OS
Windows 7 Home Premium (Retail) Full version - With SP1
CPU
3.10 Gig Intel Core i5-3350P
Motherboard
Dell 0NW73C A00
Memory
8192 Megabytes Usable Installed Memory
Monitor(s) Displays
Samsung SyncMaster [Monitor] (19.1"vis, s/n HVELA10194, Octo
Screen Resolution
1024 X 768
Hard Drives
INTEL SSDSA2CW120G3 ATA Device [Hard drive] (120.03 GB)
INTEL SSDSA2CW080G3 ATA Device [Hard drive] (80.02 GB)
Keyboard
HID Keyboard Device (HP)
Mouse
Dell (came with computer)
Internet Speed
cox high speed
Other Info
The above taken with Bel Arc Advisor
Determine if a network computer is online from a batch file REVISITED

I found this snippet of code while searching for things to help me solve the initial problem. It works like I thought it would but I don't understand what the || in the middle of the ping statement does.

Will someone give me a boost here?

Thank you.


ping racer -n 1 -w 100>nul || goto :pingerror


:pingerror
echo Host down
goto eof
:eof exit /b
 
Last edited by a moderator:

My Computer My Computer

At a glance

Windows 7 Home Premium (Retail) Full version ...3.10 Gig Intel Core i5-3350P8192 Megabytes Usable Installed Memory
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell XPS-8500
OS
Windows 7 Home Premium (Retail) Full version - With SP1
CPU
3.10 Gig Intel Core i5-3350P
Motherboard
Dell 0NW73C A00
Memory
8192 Megabytes Usable Installed Memory
Monitor(s) Displays
Samsung SyncMaster [Monitor] (19.1"vis, s/n HVELA10194, Octo
Screen Resolution
1024 X 768
Hard Drives
INTEL SSDSA2CW120G3 ATA Device [Hard drive] (120.03 GB)
INTEL SSDSA2CW080G3 ATA Device [Hard drive] (80.02 GB)
Keyboard
HID Keyboard Device (HP)
Mouse
Dell (came with computer)
Internet Speed
cox high speed
Other Info
The above taken with Bel Arc Advisor
I found this snippet of code while searching for things to help me solve the initial problem. It works like I thought it would but I don't understand what the || in the middle of the ping statement does.

Will someone give me a boost here?

Thank you.


ping racer -n 1 -w 100>nul || goto :pingerror


:pingerror
echo Host down
goto eof
:eof exit /b

I guess when I posted this the double vertical marks were interpreted as a smiley.

Anyway, never mind. I finally realized the double vertical marks were used to pipe the output of the ping. Like I said it has been a long time since I fooled around in this area.

Thanks again.
 
Last edited by a moderator:

My Computer My Computer

At a glance

Windows 7 Home Premium (Retail) Full version ...3.10 Gig Intel Core i5-3350P8192 Megabytes Usable Installed Memory
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell XPS-8500
OS
Windows 7 Home Premium (Retail) Full version - With SP1
CPU
3.10 Gig Intel Core i5-3350P
Motherboard
Dell 0NW73C A00
Memory
8192 Megabytes Usable Installed Memory
Monitor(s) Displays
Samsung SyncMaster [Monitor] (19.1"vis, s/n HVELA10194, Octo
Screen Resolution
1024 X 768
Hard Drives
INTEL SSDSA2CW120G3 ATA Device [Hard drive] (120.03 GB)
INTEL SSDSA2CW080G3 ATA Device [Hard drive] (80.02 GB)
Keyboard
HID Keyboard Device (HP)
Mouse
Dell (came with computer)
Internet Speed
cox high speed
Other Info
The above taken with Bel Arc Advisor
If you ever get this issue you can switch off smiley recognition in the advanced editor ;)

I've fixed the two posts above :)
 

My Computers My Computers

  • At a glance

    Windows 11 Pro x64 [Latest Release and Releas...Ryzen 9 5950X, 3.8 - 5.2 MHz64GB [2 x 32GB] DDR4 3200MHz4GB NVIDIA GEFORCE GTX 1650 Ti
    Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    ChillBlast - Custom to my design
    OS
    Windows 11 Pro x64 [Latest Release and Release Preview]
    CPU
    Ryzen 9 5950X, 3.8 - 5.2 MHz
    Motherboard
    Asus Prime X570-Pro
    Memory
    64GB [2 x 32GB] DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti
    Sound Card
    On-board SPDIF to 5.1 System + HDMI [5.1 system]
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160 @60Hz
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Workstation Case [Matt Black]
    Cooling
    NZXT Kraken X63 280mm CPU Cooler +2x Quiet Case fans
    Keyboard
    Logitech Wireless MX Keys & K400 + others
    Mouse
    Logitech Wireless MX Master 3S
    Internet Speed
    920 MB Down 50 MB Up
    Antivirus
    BitDefender Total Security Pro
    Browser
    Chrome (always run latest Non-Beta)
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    Samsung 10.2" tablet
    Blackview TAB 8 4G Android Tablet c/w Keyboard
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control
  • At a glance

    Windows 11 Pro x64 Latest RPIntel I7 10750H 5.0GHz32GB [2x16GB] DDR4 2933 MHznVidia GTX1650Ti 4 GB GDDR6
    Computer type
    Laptop
    System Manufacturer/Model Number
    Dell XPS 17 10750H
    OS
    Windows 11 Pro x64 Latest RP
    CPU
    Intel I7 10750H 5.0GHz
    Motherboard
    Dell XPS
    Memory
    32GB [2x16GB] DDR4 2933 MHz
    Graphics Card(s)
    nVidia GTX1650Ti 4 GB GDDR6
    Sound Card
    Stock [Realtek] 4 Speaker
    Monitor(s) Displays
    17" IPS UHD+ Infinity Edge Touchscreen
    Screen Resolution
    3840 x 2400
    Hard Drives
    2TB M2 NVMe, 4TB External + various 500GB & 1TB External NVMe (also have access to spinner HDD from
    PSU
    Stock
    Case
    Stock XPS Aluminium & Carbon Fibre
    Cooling
    Stock - Active Fan Control
    Keyboard
    Backlit + Various Logitech
    Mouse
    Stock Track Pad + Logitech MX Trackball
    Internet Speed
    72 MB Down 18MB Up
    Browser
    Chrome
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    10.2" tablet
    Sony Z3 Android Smartphone
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
    10TB NAS
If you ever get this issue you can switch off smiley recognition in the advanced editor ;)

I've fixed the two posts above :)

Thank you.
 

My Computer My Computer

At a glance

Windows 7 Home Premium (Retail) Full version ...3.10 Gig Intel Core i5-3350P8192 Megabytes Usable Installed Memory
Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dell XPS-8500
OS
Windows 7 Home Premium (Retail) Full version - With SP1
CPU
3.10 Gig Intel Core i5-3350P
Motherboard
Dell 0NW73C A00
Memory
8192 Megabytes Usable Installed Memory
Monitor(s) Displays
Samsung SyncMaster [Monitor] (19.1"vis, s/n HVELA10194, Octo
Screen Resolution
1024 X 768
Hard Drives
INTEL SSDSA2CW120G3 ATA Device [Hard drive] (120.03 GB)
INTEL SSDSA2CW080G3 ATA Device [Hard drive] (80.02 GB)
Keyboard
HID Keyboard Device (HP)
Mouse
Dell (came with computer)
Internet Speed
cox high speed
Other Info
The above taken with Bel Arc Advisor
No problem, It's easier if you view the Matrix in it's Raw form ;)
 

My Computers My Computers

  • At a glance

    Windows 11 Pro x64 [Latest Release and Releas...Ryzen 9 5950X, 3.8 - 5.2 MHz64GB [2 x 32GB] DDR4 3200MHz4GB NVIDIA GEFORCE GTX 1650 Ti
    Computer type
    PC/Desktop
    Computer Manufacturer/Model Number
    ChillBlast - Custom to my design
    OS
    Windows 11 Pro x64 [Latest Release and Release Preview]
    CPU
    Ryzen 9 5950X, 3.8 - 5.2 MHz
    Motherboard
    Asus Prime X570-Pro
    Memory
    64GB [2 x 32GB] DDR4 3200MHz
    Graphics Card(s)
    4GB NVIDIA GEFORCE GTX 1650 Ti
    Sound Card
    On-board SPDIF to 5.1 System + HDMI [5.1 system]
    Monitor(s) Displays
    32" UHD 32 Bit HDR Monitor + 43" UHD 4K 32Bit HDR TV
    Screen Resolution
    2 x 3840 x 2160 @60Hz
    Hard Drives
    1TB M2 SSD OS, 500GB Fast Access SSD, 2 x 8TB Data + Various Externals from 1TB to 4TB, 10TB NAS
    PSU
    NZXT C750 80 PLUS Gold 750W Modular PSU
    Case
    Workstation Case [Matt Black]
    Cooling
    NZXT Kraken X63 280mm CPU Cooler +2x Quiet Case fans
    Keyboard
    Logitech Wireless MX Keys & K400 + others
    Mouse
    Logitech Wireless MX Master 3S
    Internet Speed
    920 MB Down 50 MB Up
    Antivirus
    BitDefender Total Security Pro
    Browser
    Chrome (always run latest Non-Beta)
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    Samsung 10.2" tablet
    Blackview TAB 8 4G Android Tablet c/w Keyboard
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control
  • At a glance

    Windows 11 Pro x64 Latest RPIntel I7 10750H 5.0GHz32GB [2x16GB] DDR4 2933 MHznVidia GTX1650Ti 4 GB GDDR6
    Computer type
    Laptop
    System Manufacturer/Model Number
    Dell XPS 17 10750H
    OS
    Windows 11 Pro x64 Latest RP
    CPU
    Intel I7 10750H 5.0GHz
    Motherboard
    Dell XPS
    Memory
    32GB [2x16GB] DDR4 2933 MHz
    Graphics Card(s)
    nVidia GTX1650Ti 4 GB GDDR6
    Sound Card
    Stock [Realtek] 4 Speaker
    Monitor(s) Displays
    17" IPS UHD+ Infinity Edge Touchscreen
    Screen Resolution
    3840 x 2400
    Hard Drives
    2TB M2 NVMe, 4TB External + various 500GB & 1TB External NVMe (also have access to spinner HDD from
    PSU
    Stock
    Case
    Stock XPS Aluminium & Carbon Fibre
    Cooling
    Stock - Active Fan Control
    Keyboard
    Backlit + Various Logitech
    Mouse
    Stock Track Pad + Logitech MX Trackball
    Internet Speed
    72 MB Down 18MB Up
    Browser
    Chrome
    Other Info
    Also run ...
    Laptop - Quad 8GB - Windows 10 Pro x64
    Nexus 7 Android tablet x2
    10.2" tablet
    Sony Z3 Android Smartphone
    Wacom Intuos Pro Medium Pen Pad
    Wacom Intuos Pro Small Pen Pad
    Wacom Expresskeys Remote
    Loopdeck+ Graphics Controller
    Shuttle Pro v2 Control Pad
    10TB NAS
Back
Top