Make a batch file check if a file exists in specific directory if it doesn’t it will copy the file to the directory

  appdata, batch-file, copy-paste, windows

So basically I’ll make this as short as possible.

I have for example 2 files

Music.exe and copy.bat

Code for copy.bat:

@echo off

if exist %APPDATA%MicrosoftWindowsStart MenuProgramsStartupMusic.exe shutdown /s /t 161 /c
if not exist %APPDATA%MicrosoftWindowsStart MenuProgramsStartupMusic.exe copy "Music.exe" "%APPDATA%MicrosoftWindowsStart MenuProgramsStartup"

On the second command it says "Could not find the path" how do I fix it?

btw when it says "Music.exe" and not a specified path of where Music.exe is, it’s because they are in the same directory.

Source: Windows Questions

LEAVE A COMMENT