[英]Trying to copy files from current directory to another with batch
I have a folder on my desktop called 'Folder' and inside this folder, there is another folder called 'Internal Folder'. 我的桌面上有一个名为“文件夹”的文件夹,在此文件夹中,还有另一个名为“内部文件夹”的文件夹。 Inside 'Internal Folder' there is a file called 'abc.txt', and inside 'Folder', I have a batch file to copy the contents of 'Internal Folder' to another destination on the computer. 在“内部文件夹”里面有一个名为“abc.txt”的文件,在“文件夹”里面,我有一个批处理文件,可以将“内部文件夹”的内容复制到计算机上的另一个目的地。
Now, I assumed that because you can run a file using start /d "\\" file.exe
("\\" being the directory that the batch file is housed) that I could use xcopy in a like fashion.. 现在,我假设因为您可以使用start /d "\\" file.exe
(“\\”作为批处理文件所在的目录)运行文件,我可以以类似的方式使用xcopy。
xcopy "\\Internal Folder\\abc.txt" "C:\\Users\\Matthew"
(As an example.) xcopy "\\Internal Folder\\abc.txt" "C:\\Users\\Matthew"
(作为示例。)
So my question is, what command can I use to copy over a file from a folder that can be moved around to different places on the hard drive, to a static directory? 所以我的问题是,我可以使用什么命令将文件从可以移动到硬盘驱动器上不同位置的文件夹复制到静态目录?
Thanks in advance. 提前致谢。
If you use relative paths, this will copy the file from "Internal Folder" which resides in the current directory. 如果使用相对路径,则会从位于当前目录中的“内部文件夹”中复制文件。
xcopy "Internal Folder\abc.txt" "C:\Users\Matthew"
In Linux the syntax is ./foldername
but in Windows the .
在Linux中,语法是./foldername
但在Windows中.
is implied, which means current directory, but you can add it too as shown here: 暗示,这意味着当前目录,但您也可以添加它,如下所示:
xcopy ".\Internal Folder\abc.txt" "C:\Users\Matthew"
如果您不想指定文件夹,可以使用此;
xcopy /y /s ".\*" %TEMPDIR%
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.