Store user logged in .bat variable

3

I have to create a bat to automate the installation of the company's standard programs, but one in particular is giving me a headache.

The installer of one of the programs, by default, creates the path C: \ app \ client \\ product \ 12.1.0 \ client_1 for installation. But I need to replace a file inside the installation folder after it is installed.

Replacing the file would be OK if it were not for the user name in the path generated by the program installer. I could even change the path, but the idea is to automate everything, so that the user clicks next > next > next without looking at what you are doing.

My question is: How do I get the user name of the current windows session (10 PRO, if the version makes a difference), and store it in a variable.

I tried to use WMIC COMPUTERSYSTEM GET USERNAME but I can not store it in a variable.

To be honest I do not know much about bash programming, but it's just that part of the code that's missing and I can not solve it.

    
asked by anonymous 18.04.2017 / 16:02

1 answer

2

Use the global variable %username% .

    
18.04.2017 / 16:12