批處理指令碼 - 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:\
batch_script_commands.htm
廣告