批处理 中的 CD函数

首页 / 批处理入门教程 / 批处理 中的 CD函数

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

CD - 语法

cd

CD - 示例

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

链接:https://www.learnfk.comhttps://www.learnfk.com/batch-script/batch-script-cd.html

来源:LearnFk无涯教程网

@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:\

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

左耳听风 -〔陈皓〕

数据结构与算法之美 -〔王争〕

Android开发高手课 -〔张绍文〕

性能优化高手课 -〔尉刚强〕

如何落地业务建模 -〔徐昊〕

全链路压测实战30讲 -〔高楼〕

深入C语言和程序运行原理 -〔于航〕

Web 3.0入局攻略 -〔郭大治〕

程序员职业规划手册 -〔雪梅〕

好记忆不如烂笔头。留下您的足迹吧 :)