如何在Windows电脑上通过命令行运行批处理文件

下载PDF文件下载PDF文件

这篇文章将教你使用Windows命令行来运行批处理文件(.BAT)。你可以在“运行”对话框或“终端”窗口里输入命令运行程序。

方法 1
方法 1 的 2:

使用“运行”对话框

下载PDF文件
  1. How.com.vn 中文: Step 1 按下Win+R组合键,打开“运行”对话框。
    • 如果需要以管理员身份运行批处理文件,那就查阅这个方法
  2. How.com.vn 中文: Step 2 点击浏览。
  3. How.com.vn 中文: Step 3 前往批处理文件所在的文件夹。
  4. How.com.vn 中文: Step 4 点击批处理文件选中它,此时会高亮标记它。
  5. How.com.vn 中文: Step 5 点击打开。
    这会把批处理文件的完整路径粘贴到“运行”对话框中。
  6. How.com.vn 中文: Step 6 点击确定。
    在“终端”窗口里打开批处理文件,运行程序。完成运行后,窗口的底部会出现一行“按下任意键以继续”的字样。
  7. How.com.vn 中文: Step 7 按下任意按键,运行完命令后关闭“终端”窗口。
    广告
方法 2
方法 2 的 2:

使用“终端”窗口

下载PDF文件
  1. How.com.vn 中文: Step 1 点击icon“开始”菜单。
    它通常位于屏幕的左下角。
  2. How.com.vn 中文: Step 2 在搜索栏里输入cmd ,接着会出现一系列匹配的搜索结果。
  3. How.com.vn 中文: Step 3 右键点击命令提示符。
    接着会展开菜单。
  4. How.com.vn 中文: Step 4 点击以管理员身份运行。
    接着出现一条确认信息。
  5. How.com.vn 中文: Step 5 点击确定。
    用最高权限(管理员)打开命令行。
  6. How.com.vn 中文: Step 6 输入cd和批处理文件的完整路径。
    例如:
    • 如果文件在桌面上,输入cd \Users\你的登录名\Desktop
    • 如果在下载文件夹中,输入cd \Users\你的登录名\Downloads.
    • 如果不清楚自己的登录名,输入cd \Users,按下 回车键进入“用户”文件夹,然后输入dir并按下回车键来查看登录列表。
  7. How.com.vn 中文: Step 7 按下回车键进入目录。
  8. How.com.vn 中文: Step 8 输入批处理文件的名称。
    如果文件叫做“program.bat”,那就输入program.bat
    • 如果不知道名称,输入dir,按下回车键,浏览文件夹中的文件。你可以在这里看到文件的名称。
  9. How.com.vn 中文: Step 9 按下回车键,就能运行批处理文件。
    广告

关于本How.com.vn

How.com.vn 中文: How.com.vn员工
共同创作者是 :
How.com.vn专职作家
这篇文章由我们训练有素的编辑和研究团队共同创作,他们对文章的准确性和全面性进行了验证。

How.com.vn的内容管理团队会严密监督编辑人员的工作,确保每篇文章都符合我们的高质量标准要求。 这篇文章已经被读过12,784次。
本页面已经被访问过12,784次。

这篇文章对你有帮助吗?

⚠️ Disclaimer:

Content from Wiki How 中文 language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

Notices:
  • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
  • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
  • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
  • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

广告