Attempting to copy files from the current directory to another using a package

I have a folder on my desktop called "Folder", and inside this folder there is another folder called "Internal Folder". Inside the “Internal Folder” there is a file called “abc.txt”, and inside the “Folder” I have a batch file for copying the contents of the “Internal Folder” to another destination on the computer.

Now I have suggested that since you can run the file using start /d "\" file.exe("\", which is the directory where the batch file is located), that I could use xcopy in the same way.

xcopy "\Internal Folder\abc.txt" "C:\Users\Matthew" (As an example.)

So my question is: what command can I use to copy a file from a folder that can be moved to different places on the hard drive to a static directory?

Thanks in advance.

+4
source share
2 answers

If you use relative paths, this will copy the file from the "Internal folder", which is located in the current directory.

xcopy "Internal Folder\abc.txt" "C:\Users\Matthew"

On Linux, the syntax ./foldername, but on Windows ., is what the current directory means, but you can add it as well, as shown below:

xcopy ".\Internal Folder\abc.txt" "C:\Users\Matthew"
+5
source

if you do not want to specify the folder, you can use this:

 xcopy /y /s ".\*" %TEMPDIR%
+5
source

Source: https://habr.com/ru/post/1541410/


All Articles