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.

2
  • please let me know why should there be a downvote?
    – user841923
    Nov 22, 2011 at 8: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...
    – user62491
    Nov 22, 2011 at 9:19

3 Answers 3

4

Sounds like you want Logon scripts

2
  • how do you write one? what language is it?
    – user841923
    Nov 22, 2011 at 6:16
  • I have written a sample vbs script to copy a file from D:\ to C:\, where should I save the file so that it executes in login?
    – user841923
    Nov 22, 2011 at 6:34
1

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.

3
  • where is that folder located in the computer?
    – user841923
    Nov 22, 2011 at 6: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
    Nov 22, 2011 at 7:05
  • but then it would be executed only when the system boots. My requirement is to execute on user login
    – user841923
    Nov 22, 2011 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .