1.

Solve : How can i copy one file to StartUp? (in batch file)?

Answer»

for EXAMPLE i want copy 1.txt to startup and i dont KNOW user profile ...
Code: [Select]copy 1.txt C:\Docume~1\??????????\StartM~1\Programs\Startup
how?
sorry for my english ...If you don't know the user profile then you are possibly intent on copying this file on someone else's computer. This could be malicious and CH members do not assist with such practices.

I DISAGREE with your assumption this is malicious. In corporate networks there are PCs with literally 20+ profiles. If you wanted to write a script that did something profile-specific at each user's logon, setting the default printer comes to mind, this would be a perfectly legitimate need. It's just a file copy

Of course I'm not entirely sure what Mental is really trying to do. If he wants to copy 1.txt to all profile's startup group he could use the
%ALLUSERSPROFILE%

environment variable. A command like
copy 1.txt "%ALLUSERSPROFILE%\Start Menu\Programs\Startup"
(include the double quotes (") )

The all user's profile is there so it will affect everybody who logs in, new or old etc.

There's also the %USERPROFILE% variable that just points to the current profile. I guess you could use a for loop and go through each FOLDER in the "c:\documents and settings" folder. Unless he's in PLAIN MS-DOS?

Hope this helped Mental.



Discussion

No Comment Found