无涯教程-批处理 - CD函数

90 阅读1分钟

此批处理命令有助于更改其他目录或显示当前目录。

CD - 语法

cd

CD - 示例

以下示例显示了如何以多种方式使用cd命令。

@echo off
Rem The cd without any parameters is used to display the current working directory
cd
Rem Changing the path to Program Files
cd\Program Files
cd
Rem Changing the path to Program Files
cd %USERPROFILE%
cd
Rem Changing to the parent directory
cd..
cd
Rem Changing to the parent directory two levels up
cd..\..
cd

更改到各个文件夹位置后,以上命令将显示以下输出。

C:\Users\Administrator
C:\Program Files
C:\Users\Administrator
C:\Users
C:\

参考链接

www.learnfk.com/batch-scrip…