batch-filecdcomputer-name

How to get the current user name on the computer running a batch file?


This is what I need:

@echo off
title H1Z1 Launcher By Grim0
cd C:\Users\%ComputerName%\AppData\LocalLow\Daybreak Game Company\Digests\H1Z1-KingKill

That's the part that I tried but it didn't work.

%ComputerName% in path should be the user name of the current user.

How to get the current user name on the computer running the batch file instead of the computer name?


Solution

  • Try this:

    @echo off
    title H1Z1 Launcher By Grim0
    cd "%USERPROFILE%\AppData\LocalLow\Daybreak Game Company\Digests\H1Z1-KingKill"