Windows 10

Batch File To Get Computer Name

In this tutorial, we are going to see how to get computer name by using the %ComputerName% environment variable. The batch file contains a series of DOS (Disk Operating System) instructions. It allows triggering the execution of commands found in this file.
 

Batch File To Get Computer Name

The following example gets the computer name by using the %ComputerName% environment variable:

@echo off

echo %ComputerName%

Output:

MyComputer

 

Leave a Reply

Your email address will not be published. Required fields are marked *