Store user logged in variable . bat

Asked

Viewed 1,865 times

3

I have to create a bat to automate the installation of the company’s standard programs, but one specific 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. However I need to replace a file inside the installation folder after it is installed.

Replacing the file would be OK if it were not the user name in the path generated by the program’s installer. I could change the path, but the idea is to automate everything, so that the user click on next > next > next without having to look at what you’re doing.

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

I tried to use the WMIC COMPUTERSYSTEM GET USERNAME but I cannot store in variable.

To be honest I don’t know much about bash programming, but it’s just this part of the code that’s missing and I can’t solve.

1 answer

2


Use the global variable %username%.

  • Thank you very much, that’s basically it. I was taking an absurd turn to solve the problem!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.