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

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

问题描述

我想创建几个批处理文件来自动执行某些操作。

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?

推荐答案

从在您的批处理文件中:

From within your batch file:


  • %cd%将为您提供当前
    工作目录
    (变量)

  • %〜dp0 将给
    你批处理文件目录的完整路径(静态)

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

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

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