什么是批处理文件的当前目录? [英] What is the current directory in a batch file?

查看:116
本文介绍了什么是批处理文件的当前目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建两个批处理文件自动执行某些事情。

I want to create a couple of batch files to automate some thing.

我的问题是,当我创建一个批处理文件。什么是当前的目录?
它是该文件所在的目录或者是它出现在cmd中相同的目录?

My question is when I create a batch file. What is the current directory? Is it the directory where the file is located or is it the same directory that appears in cmd?

推荐答案

从您的批处理文件中:


  • %CD%会给你电流
    工作目录
    (变量)

  • %〜DP0 会给
    你的完整路径的批处理文件的目录(固定)

  • %cd% will give you the current working directory (variable)
  • %~dp0 will give you the full path to the batch file's directory (fixed)

这篇关于什么是批处理文件的当前目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆