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
256 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

810 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