dotnet-learn-vs/WebMVC/WebMVCApi/md/CMD 获取当前脚本各种路径.md
2023-05-12 23:19:15 +08:00

28 lines
615 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
icon: edit
date: 2023-03-17
category:
- 系统配置
tag:
- cmd
- 路径
headerDepth: 5
---
# CMD 获取当前脚本各种路径
```cmd
@echo off
echo 当前盘符:%~d0
echo 当前盘符和路径:%~dp0
echo 当前批处理全路径:%~f0
echo 当前盘符和路径的短文件名格式:%~sdp0
echo 当前CMD默认目录%cd%
echo 目录中有空格也可以加入""避免找不到路径
echo 当前盘符:"%~d0"
echo 当前盘符和路径:"%~dp0"
echo 当前批处理全路径:"%~f0"
echo 当前盘符和路径的短文件名格式:"%~sdp0"
echo 当前CMD默认目录"%cd%"
pause
```