Computing.Net > Forums > Programming > I need to copy a file to each users

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

I need to copy a file to each users

Reply to Message Icon

Name: joenet2k
Date: November 11, 2007 at 09:59:01 Pacific
OS: Win2k
CPU/Ram: 1Gb RAM
Product: Dell 1600/1800
Comment:

I've been searching for several hours and have come up empty handed. I hope someone can help me. I'd greately appretiate it.

I need a script (preferably a DOS type) to copy a bat file (which inserts registry settings for IE and delete itself) to each users documents and settings\start up folder. The script will run under the administrators privelage and copy the file this way the bat will execute when the user logs on and delete it self.

I've looked into the RunOnce keys, but it seems the one required is the RunOnce found in the HKCU hive which only loads when the user logs on. Thanks again




Sponsored Link
Ads by Google

Response Number 1
Name: klint
Date: November 11, 2007 at 14:32:57 Pacific
Reply:

Here are a few ideas to think about...

1. Not all computers use the same directory name (usually C:\Documents and Settings) for user profiles. Sometimes it's on drive D:, sometimes the directory has a different name. Therefore, to get a list of active users on the machine, use:

dir /b "%userprofile%\.."

(By active I mean those who have logged on interactively at least once.)

2. Even if you run the script that changes the registry settings for every single user on that machine, you still want to ensure the new registry settings are correct for any user created in the future. Therefore, you need to change the registry settings for the "Default" user, which is where a new user's settings are copied from.

3. If you create the batch file from an Administrator account, it will, by default, have the Administrator as owner, even if it is stored in another user's folder. When the user runs it and it tries to delete itself, it may not have sufficient privileges to do so. Take care to give this batch file the appropriate delete access, and test it.


0

Response Number 2
Name: Mechanix2Go
Date: November 12, 2007 at 10:01:54 Pacific
Reply:

@echo off
setLocal EnableDelayedExpansion

pushd "C:\Documents and Settings\"
for /f "tokens=* delims= " %%a in ('dir /b/ad') do (
copy c:\temp\somefile.txt "%%a\Start Menu\Programs\Startup"
)



=====================================
If at first you don't succeed, you're about average.

M2



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: I need to copy a file to each users

Copy a file to system32 folder of multiple co www.computing.net/answers/programming/copy-a-file-to-system32-folder-of-multiple-co/19810.html

I need help with bat file - please help www.computing.net/answers/programming/i-need-help-with-bat-file-please-help/2971.html

Batch File - Find and copy a file www.computing.net/answers/programming/batch-file-find-and-copy-a-file/16744.html