Вопрос

I am learning how to use xcopy to copy a folder to a user's profile. The PC has multiple users therefore the batch file will need to get the username and then go into the folder structure inside the username.

EG: We have a PC with multiple users. Lets say one user is called User1 and one User2 need a folder located in C:\FolderToCopy

The FolderToCopy needs to be copied to C:\Users\User1\AppData\NewFolderLocation for user 1 and to C:\Users\User2\AppData\NewFolderLocation for user 2.

Can somebody help me in defining some sort of local variable where the user name is picked up based on who is logged in to the PC?

Это было полезно?

Решение

just use the predefined variables:

%username%
%userprofile%
%localappdata%
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top