Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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

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.

@echo off
setLocal EnableDelayedExpansionpushd "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

![]() |
![]() |
![]() |

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