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
255 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 83

Assisted Solution

by:oBdA
oBdA earned 200 total points
ID: 24145901
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
ID: 24145925
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
ID: 24145964
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
ID: 24158834
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 83

Expert Comment

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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
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…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

929 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

11 Experts available now in Live!

Get 1:1 Help Now