How can I program a bat file that would be capable of putting file.dll that is in the same folder that a .bat file is in into the windowsMainDir/system32 folder but only if the file does not already exist?
How can I program a bat file that would be capable of putting file.dll
Share
Create your batch file like “copy_file.cmd” and put in these contents:
If the destination file does not exist, it will copy the source file to the destination. The
/Vswitch makes copy verify that the file was copied correctly, and is optional.The
%~dp0inSRCtakes the drivedand pathpfrom the variable%0(the batch file’s path) and uses that path as a prefix tofile.dll. You want do do this to guarantee that the script always takes the file from the same directory as the batch file, and not the current directory. E.g., if your batch file was on a network drive mapped toH:, you could still run it fromC:.