windows下的批处理命令
来源:互联网 发布:上海一手房成交数据 编辑:程序博客网 时间:2024/05/14 02:42
本文主要参考:http://www.360doc.com/content/15/1014/17/1564981_505628059.shtml
在开始种键入cmd之后,会弹出命令行窗口,以下是一些常用的指令:
1、cd 为更改工作目录指令。如果更改了盘符 需要加 /d 比如:
C:\Users\administrator>cd /d F:\BaiduCloudF:\BaiduCloud>
2、cd /d "%~dp0" 改变当前路径到批处理文件所在路径。
%0指批处理文件本身,%dp0是对%0的扩展,d指的是盘符(drive),p指的是路径,所以%dp0指的是批处理所在的路径。
pushd %~dp0 是指设定批处理文件所在的目录为工作目录,同时将该目录压入临时栈。
%~dp0content指的是批处理文件所在目录下的目录content。
popd将栈顶目录弹出,同时将栈中下一个元素设为工作目录。
执行如下脚本:
rem the current bat file is in G:\testBatcd /d C:\Windows\Helpecho. current path %cd%pushd G:\OSecho. current path %cd%popd echo. current path %cd%pushd %~dp0echo. current path %cd%pushd %~dp0contentecho. current path %cd%结果如下:
G:\testBat>testBat.batG:\testBat>rem the current bat file is in G:\testBatG:\testBat>cd /d C:\Windows\HelpC:\Windows\Help>echo. current path C:\Windows\Help current path C:\Windows\HelpC:\Windows\Help>pushd G:\OSG:\OS>echo. current path G:\OS current path G:\OSG:\OS>popdC:\Windows\Help>echo. current path C:\Windows\Help current path C:\Windows\HelpC:\Windows\Help>pushd G:\testBat\G:\testBat>echo. current path G:\testBat current path G:\testBatG:\testBat>pushd G:\testBat\contentG:\testBat\content>echo. current path G:\testBat\content current path G:\testBat\contentG:\testBat\content>
0 0
- windows下的批处理命令
- Windows下清理svn的批处理命令
- windows下copy批处理命令
- WINDOWS下批处理脚本命令
- metapost的windows批处理命令
- windows下清除文件批处理命令
- Windows下的“vbs批处理”
- Windows下的“批处理”[转]
- windows 下简单的批处理
- Windows下批处理的使用
- windows下的mysql批处理
- linux下增加自动执行的命令(即windows下的批处理)的方法
- windows中批处理命令的编写
- 一些常用的windows批处理命令
- 用命令或批处理命令一次删除windows系统一个目录下的所有文件
- 删掉A目录下所有~$开头的文件(Windows批处理bat命令)
- WINDOWS批处理命令详解
- windows批处理命令详解
- cmpp3 模拟器
- 1.基础
- jsp的基础语法
- Redis常见使用说明
- 分类决策树原理及实现(五)
- windows下的批处理命令
- Latex Command for argmin or argmax?
- 【韩顺平Linux笔记02】用户管理和目录结构
- MySQL 之 ROUND 函数四舍五入的陷阱
- 洛谷 P1739 表达式括号匹配
- LayoutInflater的一些理解
- python map 函数
- python3.5以上 爬虫 (模块化)
- 常见异常以及处理问题办法