0

I created a small harmless batch virus (a prank), it is finished (on a USB) but I don't want to manually copy it and then I ran to a problem...

Is there a way to copy files relatively, from where the actual batch file is?

Something like this maybe:

copy "~Virus.bat" "%appdata%/microsoft/windows/start menu/programs/startup"

instead of

copy "G:\Files\Folder1\Folder2\Virus.bat" "%appdata%/microsoft/windows/start menu/programs/startup"

If somebody can help please do... Thanks!

Toxxus
  • 5
  • 4

1 Answers1

2

This question may solve your problem, but a short answer for copying your file is using %~dp0. As said in this answer, this will give you the current path.

Try this:

copy "%~dp0Virus.bat" "%appdata%/microsoft/windows/start menu/programs/startup"
Community
  • 1
  • 1
Rafael
  • 3,042
  • 3
  • 20
  • 36