Solved

How can I copy a file to the start up folder of the start menu in win xp using a batch script?

Posted on 2009-04-15
5
254 Views
Last Modified: 2013-11-09
What I want is to copy a file to the startup folde in the start menu using a batch script. The problem is that the location of the start menu folder depends on the current user logged on, so I guess i have to use a environment varioable of some sort similiar to e.g. %desktop%.
I'm using xcopy to do the copying.
0
Comment
Question by:Suppai
5 Comments
 
LVL 82

Assisted Solution

by:oBdA
oBdA earned 200 total points
Comment Utility
The variable to use is normally
%UserProfile%\Desktop

The following will retrieve the current desktop folder on XP even if this folder is redirected through a group policy:

for /f "tokens=2*" %%a in ('reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" ^| find /i "Desktop"') do set DesktopFolder=%%b
echo User's desktop folder: %DesktopFolder%
0
 

Author Comment

by:Suppai
Comment Utility
I actually asked for the location of the start menu folder of the user logged on and not the desktop.
Ive googled it a bit and found that this might work, but havent got the chance to test it yet.Is this the location I'm looking for?

"C:\Documents and Settings\%USERNAME%\Start Menu\Programs\Startup\"
0
 
LVL 21

Accepted Solution

by:
JBlond earned 300 total points
Comment Utility
Yes, but you can also use %USERPROFILE%\Start Menu\Programs\Startup.

Besides that, if you're using a Windows 2003 network with at least one Vista workstation, you could also use Group Policy Preferences for this.
http://www.microsoft.com/downloads/details.aspx?FamilyID=42E30E3F-6F01-4610-9D6E-F6E0FB7A0790&displaylang=en
0
 
LVL 6

Expert Comment

by:Justin_W_Chandler
Comment Utility
WHY am I missing out on several question? Are they not getting posted to the Windows Batch zone?? oBdA, do you know what zone this question was posted in originally?

Justin Chandler
0
 
LVL 82

Expert Comment

by:oBdA
Comment Utility
Must have been Windows Batch Scripting, it's the only one of the three above I actively monitor.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now