Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

shell:Common Startup as a parameter to XCOPY

- - - - -

  • Please log in to reply
1 reply to this topic

#1
boogerlad

boogerlad

    Junior

  • Member
  • Pip
  • 52 posts
I have a simple batch script that copies a file to the startup folder, but it appears that I can't use shell:Common Startup as a parameter to xcopy. I have tried this

xcopy hurrdurr.exe "shell:Common Startup"

and many other variations, and they don't work. As an aside, if this did work, "hurrdurr.exe" would run on every startup right, assuming I got clearance via uac to do the xcopy operation? The os in question is Windows XP and proceeding. I know that people recommend against putting executables directly into the startup folder, but I'm just curious why this doesn't work.

Thanks!


How to remove advertisement from MSFN

#2
Yzöwl

Yzöwl

    Wise Owl

  • Super Moderator
  • 4,530 posts
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

You cannot use shell: like that when you are not within the shell.

One way, common to Windows XP through Windows 8 is to get the location from the registry using a batch file.
@ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION
SET "SF_=SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\EXPLORER\USER SHELL FOLDERS"
FOR /F "TOKENS=*" %%# IN (
	'REG QUERY "HKLM\%SF_%" /V "COMMON STARTUP"^|FIND "REG_"') DO SET "FL_=%%~#"
CALL :SUB %FL_:*_SZ=%
GOTO :EOF
:SUB
COPY "YourFile.ext" "%*"





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN