文件夹的复制移动_如何在Windows 10上复制或移动文件和文件夹

文件夹的复制移动

文件夹的复制移动

Microsoft Windows logo.

Windows offers many ways to copy and move files. We’ll show you all the tricks for File Explorer, and how to use them in Command Prompt and PowerShell. You can even add “Copy to” and “Move to” to File Explorer’s context menus.

Windows提供了许多复制和移动文件的方法。 我们将向您展示File Explorer的所有技巧,以及如何在Command Prompt和PowerShell中使用它们。 您甚至可以在“文件资源管理器”的上下文菜单中添加“复制到”和“移动到”。

When you copy a file or folder in Windows 10, a duplicate is made of the selected item and saved in a destination folder of your choosing. However, when you move a file or folder, the original item moves to the destination folder instead of sending an identical copy.

在Windows 10中复制文件或文件夹时,将对所选项目进行复制并保存在您选择的目标文件夹中。 但是,当您移动文件或文件夹时,原始项目将移至目标文件夹,而不是发送相同的副本。

如何通过拖放复制或移动文件 (How to Copy or Move Files with Drag and Drop)

One of the most common methods to copy or move a file or folder is to drag and drop it into the destination folder. By default—depending on the location of the destination folder—File Explorer might move it instead of copying it, or vice versa. However, there’s a hidden method that overrides Windows’ default behavior.

复制或移动文件或文件夹的最常见方法之一是将其拖放到目标文件夹中。 默认情况下(取决于目标文件夹的位置),文件资源管理器可能会移动它而不是将其复制,反之亦然。 但是,有一个隐藏方法可以覆盖Windows的默认行为。

Open File Explorer by pressing Windows+E and navigate to the file you want to copy.

通过按Windows + E打开File Explorer,然后导航到要复制的文件。

Open File Explorer to the files you want to copy.

When dragging files from one folder to another, you can use either the pane on the left or open another instance of File Explorer to navigate to the destination folder. For this example, we’re going to use a second File Explorer window to copy files.

将文件从一个文件夹拖到另一个文件夹时,可以使用左侧的窗格,也可以打开“文件资源管理器”的另一个实例导航到目标文件夹。 对于此示例,我们将使用第二个“文件资源管理器”窗口来复制文件。

Open a second File Explorer window by pressing Windows+E, and navigate to the destination folder.

通过按Windows + E打开第二个“文件资源管理器”窗口,然后导航到目标文件夹。

Open a second File Explorer and select the files to copy.

Windows has two default actions when you drag and drop a file or folder into a new destination: copy or move. Copying happens when you drop the file or folder into a directory on a different drive. Moving occurs when you drop it on the same drive, as we’ll do below. However, there’s a hidden trick that forces Windows to perform a specific action.

将文件或文件夹拖放到新目标位置时,Windows有两个默认操作:复制或移动。 当您将文件或文件夹拖放到其他驱动器上的目录中时,就会进行复制。 当您将其拖放到同一驱动器上时,便会发生移动,如下所述。 但是,有一个隐藏的技巧迫使Windows执行特定操作。

To copy files over to a different drive, highlight the file(s) you want to copy, click and drag them over to the second window, and then drop them.

要将文件复制到另一个驱动器,请突出显示要复制的文件,单击并将其拖到第二个窗口中,然后将其拖放。

Drag the files over to the second window and drop them.

If you’re trying to copy the files to a folder on the same drive, click and drag them over to the second window. Before you drop them, though, press Ctrl to trigger the Copy mode.

如果您试图将文件复制到同一驱动器上的文件夹中,请单击并将它们拖到第二个窗口中。 但是,在放下它们之前,请按Ctrl键触发“复制”模式。

If you want to copy a file onto the same drive, press Ctrl before dropping it into the window.

To move files to a different directory on the same drive, highlight the file(s) you want to move, click and drag them over to the second window, and then drop them.

要将文件移动到同一驱动器上的其他目录,请突出显示要移动的文件,单击并将其拖放到第二个窗口,然后将其拖放。

Click and drag the files over to the second window.

If the destination folder is on a different drive, click and drag them over to the second window just like before, but this time press Shift to trigger the Move mode.

如果目标文件夹位于其他驱动器上,则像以前一样单击并将它们拖到第二个窗口,但是这次按Shift触发“移动”模式。

To move files to a a folder on a different drive, click and drag them, but before you drop, press Shift.

如何使用剪切,复制和粘贴复制或移动文件 (How to Copy or Move Files Using Cut, Copy, and Paste)

You can also copy and move files with the clipboard, the same way you cut, copy, and paste text.

您还可以使用剪贴板来复制和移动文件,就像剪切,复制和粘贴文本一样。

Open File Explorer by pressing Windows+E and navigate to the file you want to copy.

通过按Windows + E打开File Explorer,然后导航到要复制的文件。

Open File Explorer and navigate to the folder with files you want to copy.

Highlight the files you want to copy, and then click “Copy” in the File menu or press Ctrl+C on the keyboard to add them to the clipboard.

突出显示要复制的文件,然后在“文件”菜单中单击“复制”,或在键盘上按Ctrl + C将其添加到剪贴板。

Highlight the files and click "Copy" from the Home tab.

If you’d rather move items instead, highlight the files you want to move. Then, click “Cut” in the File menu or press Ctrl+X to add the files to the clipboard.

如果您想移动项目,请突出显示要移动的文件。 然后,在“文件”菜单中单击“剪切”,或按Ctrl + X将文件添加到剪贴板。

Select the files and click "Cut" from the Home tab.

Navigate to the directory to which you want to move the files, and then click “Paste” in the “Home” tab or press Ctrl+V. Depending on whether you click “Copy” or “Cut,” your files will be copied or moved, respectively.

导航到要将文件移动到的目录,然后在“主页”选项卡中单击“粘贴”或按Ctrl + V。 根据您单击“复制”还是“剪切”,文件将分别被复制或移动。

Navigate to the destination folder and click "Paste" from the "Home" tab.

使用上下文菜单复制或移动文件和文件夹 (Copying or Moving Files and Folders Using the Context Menu)

The Windows 10 Context menu with "Copy to" and "Move to" included.

When you right-click a file or folder, Windows has a couple of hidden context menu functions that let you add two options: Copy to or Move to. Adding these two functions to the context menu gives you a way to either copy or move items in just a few clicks.

右键单击文件或文件夹时,Windows有几个隐藏的上下文菜单功能,可让您添加两个选项:复制到或移动到。 将这两个功能添加到上下文菜单中,使您只需单击几下即可复制或移动项目。

如何使用命令提示符复制或移动文件 (How to Copy or Move Files Using the Command Prompt)

One of the fastest ways to open a Command Prompt in the desired directory is from File Explorer. First, open File Explorer and navigate to the destination. Click the address bar, type “cmd”  and press Enter.

在所需目录中打开命令提示符的最快方法之一是从文件资源管理器中。 首先,打开文件资源管理器并导航到目标位置。 单击地址栏,键入“ cmd ”,然后按Enter。

From File Explorer, type "cmd" in the address bar and press Enter.

To copy a file, you can use the following command syntax (if you’re copying a folder, just omit the file extension):

要复制文件,可以使用以下命令语法(如果要复制文件夹,则只需省略文件扩展名):

copy "file name.ext" "full\path\to\destination\folder"

The quotes in the command are only important when the file name or folder contains spaces. If they don’t have spaces, you won’t need to include the quotes. In the example below, neither the file name, nor the folder contains a space, so we didn’t need to use them.

仅当文件名或文件夹包含空格时,命令中的引号才重要。 如果它们没有空格,则无需添加引号。 在下面的示例中,文件名和文件夹都不包含空格,因此我们不需要使用它们。

The file gets copied to the destination folder.

You can also use the copy command to duplicate multiple files at the same time. Just separate each file with a comma, and then specify the destination folder as you normally would.

您也可以使用copy命令同时复制多个文件。 只需用逗号分隔每个文件,然后照常指定目标文件夹。

Separate multiple files with a comma to copy them over.

To move a file, you can use the following command syntax (if you’re moving a folder, just omit the file extension):

要移动文件,可以使用以下命令语法(如果要移动文件夹,只需省略文件扩展名):

move "file name.ext" "full\path\to\destination\folder"

Just as with copying, the quotes in the command are only important when the file name or folder contains spaces. If they don’t, you don’t have to include the quotes. In the example below, neither the file name, nor the folder contains a space, so we didn’t need to use them.

与复制一样,仅当文件名或文件夹包含空格时,命令中的引号才重要。 如果没有,则不必包含引号。 在下面的示例中,文件名和文件夹都不包含空格,因此我们不需要使用它们。

The command moves the file over.

However, if you try to move multiple files, as we did with the copy command, Command Prompt will throw a syntax error.

但是,如果您尝试移动多个文件(如对copy命令所做的那样),则命令提示符将引发语法错误。

Using a comma to move more than one file does not work and Command Prompt will throw an error.

There are a couple of other ways to move more than one item at a time using Command Prompt without throwing an error. Each method makes use of a wildcard character to move multiple files within one instruction.

还有其他两种方法可以使用命令提示符一次移动一个以上的项目而不会引发错误。 每种方法都使用通配符在一条指令中移动多个文件。

First, if you want to move all of a specific file type, you can use the following syntax to relocate the files:

首先,如果要移动所有特定文件类型,则可以使用以下语法重新定位文件:

move *.ext "full\path\to\directory"
Use a wildcard to move all files with a specific extension type.

The second method involves moving everything inside the source directory, regardless of the file type. You can use the following syntax to complete the move:

第二种方法涉及在文件目录中移动所有内容,而不管文件类型如何。 您可以使用以下语法来完成移动:

move * "full\path\to\directory"
Move every file that's inside the folder.

如何使用PowerShell复制或移动文件 (How to Copy or Move Files Using PowerShell)

Windows PowerShell is even more powerful and flexible than Command Prompt when it comes to copying or moving files and folders in a command-line environment. While we’ll only scratch the surface, you can do some really powerful things with cmdlets.

当在命令行环境中复制或移动文件和文件夹时,Windows PowerShell比命令提示符更加强大和灵活。 虽然我们只会刮擦表面,但您可以使用cmdlet进行一些非常强大的操作。

The quickest way to open a PowerShell window at your desired location is to first open the folder in File Explorer. In the “File” menu, click “Open Windows PowerShell,” and then select “Open Windows Powershell.”

在所需位置打开PowerShell窗口的最快方法是首先在“文件资源管理器”中打开文件夹。 在“文件”菜单中,单击“打开Windows PowerShell”,然后选择“打开Windows Powershell”。

Click File > Open Windows PowerShell > Open Windows PowerShell.

To copy a file or folder in PowerShell, use the following syntax:

要在PowerShell中复制文件或文件夹,请使用以下语法:

Copy-Item "filename.ext" "path\to\destination\folder"

Although they aren’t mandatory, the Copy-Item cmdlet only requires quotes around the filename and directory if they contain spaces.

尽管不是强制性要求,但如果Copy-Item cmdlet包含空格,则仅需要在文件名和目录两边加上引号。

For example, to copy a file from the current directory to another, you would use the following command:

例如,要将文件从当前目录复制到另一个目录,可以使用以下命令:

Copy-Item Lex.azw D:\Downloads
Type the command and the file will copy over to the destination folder.

The real power of PowerShell comes from the ability to pipe cmdlets together. Say, for example, we have a folder with a bunch of subfolders with ebooks in them that we want to copy.

PowerShell的真正功能来自将cmdlet传递到一起的功能。 举例来说,我们有一个文件夹,其中包含一堆子文件夹,其中有我们要复制的电子书。

Instead of changing the directory and running the command again, we can get PowerShell to scan through each folder and subfolder, and then copy all of a specific file type to the destination.

无需更改目录并再次运行命令,我们可以使PowerShell扫描每个文件夹和子文件夹,然后将所有特定文件类型复制到目标位置。

We could use the following cmdlet:

我们可以使用以下cmdlet:

Get-ChildItem -Path ".\*.azw" -Recurse | Copy-Item -Destination "D:\Downloads"

The Get-ChildItem part of the cmdlet lists all the files in the current directory and all of its subfolders (with the -Recurse switch) with the AZW file extension and pipes them (the | symbol) to the Copy-Item cmdlet.

cmdlet的Get-ChildItem部分列出了当前目录中的所有文件及其所有子文件夹(带有-Recurse开关)以及AZW文件扩展名,并将它们( |符号)通过管道传递到Copy-Item cmdlet。

After you type the command, PowerShell searches all subfolders copies anything within the specified file extension.

To move files instead, you can use the following syntax to relocate anything you want:

要移动文件,可以使用以下语法重新定位所需的任何内容:

Move-Item Lex.azw D:\Downloads
The item has been moved.

Move-Item follows the same syntax as the Copy-Item cmdlet. So, if you want to move all the specific file types from a folder and all its subfolders—as we did with the Copy-Item cmdlet— it’s almost identical.

Move-Item遵循与Copy-Item cmdlet相同的语法。 因此,如果要从文件夹及其所有子文件夹移动所有特定的文件类型(就像我们对Copy-Item cmdlet所做的那样),则几乎是相同的。

Type the following cmdlet to move all files of a specific file type from a directory and its subfolders:

键入以下cmdlet,以从目录及其子文件夹中移动特定文件类型的所有文件:

Get-ChildItem -Path ".\*.azw" -Recurse | Move-Item -Destination "D:\Downloads"
Moving files in PowerShell.

翻译自: https://www.howtogeek.com/667029/how-to-copy-or-move-files-and-folders-in-windows-10/

文件夹的复制移动

  • 0
    点赞
  • 0
    评论
  • 3
    收藏
  • 扫一扫,分享海报

参与评论 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值