2

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.

user841923
  • 143
  • 1
  • 1
  • 5
  • please let me know why should there be a downvote? – user841923 Nov 22 '11 at 08:01
  • Probably because it wasn't really clear what you were asking. And because it was a pretty "basic" question, although it's perfectly legitimate one in my opinion. @ptman has your answer... –  Nov 22 '11 at 09:19

3 Answers3

4

Sounds like you want Logon scripts

ptman
  • 27,124
  • 2
  • 26
  • 45
0

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.

0

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.

paulmorriss
  • 277
  • 1
  • 3
  • 15
Hanan N.
  • 378
  • 5
  • 16
  • where is that folder located in the computer? – user841923 Nov 22 '11 at 06:58
  • Windows 7 and Vista c:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup Windows XP c:\Documents and Settings\[username]\Start Menu\Programs\Startup – Hanan N. Nov 22 '11 at 07:05
  • but then it would be executed only when the system boots. My requirement is to execute on user login – user841923 Nov 22 '11 at 08:25