Avatar of Maverickpoet
Maverickpoet
 asked on

Need to create a batch file or vbs script to copy a file to multiple user profiles

I need help creating a script or batch file to move a file from c:\Downloads\test.vbs to c:\users\%usernames%\appdata\Roaming\Microsoft\Windows\Startup\Programs folder.

I've got a change that i need to have update a multiple user workstation, but there are a TON of user profiles on this comp.


Any help is appreciated. :)

-Mav
Microsoft Legacy OS

Avatar of undefined
Last Comment
Lionel MM

8/22/2022 - Mon
Brad Bouchard

Use Robocopy, it's so simple.  Try this:

From a command prompt with administrator level privilege run the command:

Robocopy C:\Users\USERWHEREFILEISYOUWANTTOCOPY\Downloads C:\users\%usernames%\appdata\Roaming\Microsoft\Windows\Startup\Programs folder

Simple.
Brad Bouchard

Excuse my mistake on the first suggestion it should look like this:

C:\Users\USERWHEREFILEISYOUWANTTOCOPY\Downloads C:\users\%usernames%\appdata\Roaming\Microsoft\Windows\Startup\Programs folder filename.file
Brad Bouchard

Sorry for the three comments in a row, I just wanted to point out that you use first

Robocopy

Then the location of the current file you want copied (i.e. C:\users\userinquestion\downloads

Then the location where you want the file copied to (i.e. C:\users\%usernames%\appdata\Roaming\Microsoft\Windows\Startup\Programs folder)

Then the actual file name (filename.file)

Robocopy takes the first command, the first location, and the last location and says ok move this file to this location.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Maverickpoet

ASKER
How could i use robocopy to copy it to all the profiles? when i tried the above, the robocopy only copied it to the admin's profile location.
Brad Bouchard

I think you need %username% instead of usernames.  Also, make sure you right click command prompt and select "Run as Administrator"
ASKER CERTIFIED SOLUTION
Brett_MCITP

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
achaldave

Just copy files to this location and it will be available to all users.
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Lionel MM

You are wanting to copy file c:\Downloads\test.vbs to all profiles all at once, right? The above examples will work to copy the file to the profiles WHEN the users logon again. In other words, by using either GPO or a logon script the above solutions will copy the required file to the user's profiles once they logon. And I think you want a solution to copy that file to each profile NOW and not when they logon, am I right?