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
259 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 84

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 84

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

749 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