如何使用命令提示符查找和打开文件

Microsoft Windows Logo

Once you’ve learned how to navigate directories on Windows 10, the next step is learning how to find and open files using the Command Prompt. It’s just as easy as navigating through and opening a file in File Explorer. Here’s how it’s done.

学习完Windows 10上的目录导航后 ,下一步就是学习如何使用命令提示符查找和打开文件。 就像在File Explorer中浏览和打开文件一样简单。 这是完成的过程。

First, open the Command Prompt on your PC by typing “cmd” in the Windows Search bar and then selecting “Command Prompt” from the search results.

首先,通过在Windows搜索栏中键入“ cmd”,然后在搜索结果中选择“命令提示符”,在PC上打开命令提示符

Command prompt app in windows search

With the Command Prompt opened, you’re ready to find and open your file.

打开命令提示符后,您就可以找到并打开文件。

使用命令提示符查找文件 (Find Files Using Command Prompt)

Maybe you already know the file path to the item you want to open–maybe not. If not, you don’t need to search through File Explorer just to come back to the Command Prompt later. You can use this command instead:

也许您已经知道要打开的项目的文件路径,也许还不知道。 如果不是这样,您不需要搜索文件浏览器就可以稍后再返回到命令提示符。 您可以改用以下命令:

dir "\search term*" /s

dir "\search term*" /s

Just replace “search term” with, of course, the actual search term. So, if we wanted to locate our file called “Example File,” we’d use this command:

当然,只要用实际的搜索词替换“搜索词”即可。 因此,如果我们要查找名为“示例文件”的文件,则可以使用以下命令:

dir "\example file*" /s

dir "\example file*" /s

Command Prompt will now search and find all instances of the search term you entered. It will (1) show you the file path, and (2) give you the file name and extension.

现在,命令提示符将搜索并找到您输入的搜索词的所有实例。 它将(1)向您显示文件路径,以及(2)给您文件名和扩展名。

Find a file in the folder with dir command

Now that we’ve found our file, let’s open it.

现在我们找到了文件,让我们打开它。

使用命令提示符打开文件 (Open Files Using Command Prompt)

To open the file, you need to navigate to the directory in the Command Prompt that contains the file you would like to open. In this example, we’ve created an “Example” folder in our “Documents” folder, so we’ll head there.

要打开文件,您需要导航到命令提示符中的目录,该目录包含您要打开的文件。 在此示例中,我们在“文档”文件夹中创建了“示例”文件夹,因此我们将前往该文件夹。

In Command Prompt, use the Change Directories command ( cd <folder> ) to navigate through your folders. Because we’re currently at the top level of the computer’s file system, we’ll need to go to “Documents” first and then “Example.” So, we’ll use this command:

在命令提示符中,使用“更改目录”命令( cd <folder> )浏览文件夹。 因为我们目前处于计算机文件系统的顶层,所以我们需要先进入“文档”,然后再进入“示例”。 因此,我们将使用以下命令:

cd Documents\Example

cd Documents\Example

Note that you must navigate to the immediate file structure. In this case, we can’t skip “Documents” and jump straight to “Example.”

请注意,您必须导航到立即文件结构。 在这种情况下,我们不能跳过“文档”而直接跳至“示例”。

Use the cd command to navigate folders

Once you have inputted your command, press the Enter key. You’ll now be in that folder.

输入命令后,按Enter键。 您现在将在该文件夹中。

Command Prompt showing the user which folder they are currently in

It’s now time to open the file within that folder. Our file is named “Example File.”

现在是时候在该文件夹中打开文件了 。 我们的文件名为“示例文件”。

To open the file, enter the file name and extension in quotations. In this case:

要打开文件,请在引号中输入文件名和扩展名。 在这种情况下:

“example file.docx”

“example file.docx”

enter file name and extension in command prompt to open file

The file will now open.

现在将打开文件。

To make things a bit quicker, you can actually navigate to the correct folder and open the file in a single command. Assuming we are back at the top level, we would run this command:

为了使操作更快一些,您实际上可以导航到正确的文件夹并通过单个命令打开文件。 假设我们回到顶层,我们将运行以下命令:

“Documents\Example\example file.docx”

“Documents\Example\example file.docx”

Enter file open command in one command

The only difference is you don’t add the cd command and the entire path is in quotations.

唯一的区别是您不添加cd命令,并且整个路径都用引号引起来。

翻译自: https://www.howtogeek.com/674537/how-to-find-and-open-files-using-command-prompt/

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值