Detecting a laptop from a batch file - TechRepublic
General discussion
October 13, 2009 at 08:19 AM
curtis

Detecting a laptop from a batch file

by curtis . Updated 16 years, 8 months ago

I have never seen a foolproof way to detect a laptop from a batch file, and the WMI scripts out there aren’t 100% either. However, I use a couple of methods that may be helpful:

ipconfig | find “Wireless” > nul
if errorlevel 0 if not errorlevel 1 goto laptop

This method works by looking for WiFi, if your org doesn’t have many standalone PCs with WiFi cards. The problem with this is if the laptop’s WiFi switch is off or the WiFi interface is disabled from Network Connections, it doesn’t show up in ipconfig.

ipconfig /all | find “Dhcp Enabled. . . . . . . . . . . : Yes”
if errorlevel 0 if not errorlevel 1 goto laptop

The above method works well if the only DHCP Windows PCs logging into your domain are laptops. In our case, all desktops have static IPs.

This discussion is locked

All Comments