How to execute a batch file each time a user logins?

How to execute a batch file each time a user logins?

I've written a batch script which copies of some files in the CommonAppData folder (C:\ProgramData) to the logged in User's Local AppData. What I would like to do is to execute this script for every user every time they login. I found many articles talking about the execution of batch files on startup but I would like to know how to do the same on each login.

I've a written a batch file and copied it in :

C:\Windows\System32\GroupPolicy\User\Scripts\Logon

But it does not seem to be working.

решение1

Sounds like you want Logon scripts

решение2

Put your batch/script file in: C:\windows\system32\GroupPolicy\User\Scripts\Logon Note: no spaces in the filename use _ or - instead ie: map_drive.bat or map-drive.bat not: map drive.bat

Once complete open gpedit.msc Select user configuration->windows settings->scripts Double click on Logon Select add and browse to your batch/script file Make sure you click "Apply" or your changes will not be saved.

решение3

In case it is needed at home or something small you could put it in the Startup folder of the user, it get executed each time the user enters the system.

It is simple, but I like to keep things like that.

Связанный контент