bat :
cd /d %~dp0
cd到bat文件当前所在的目录下。
- @echo off
-
- set current_path=%~dp0 #设置当前路径
-
- start %current_path%\temp.exe %1 %2 %3 %4
把路径当一个参数来使用
shell :
- #!/bin/bash
- # 不同的头是会影响获取路径的方式的
-
- CurDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- echo $CurDir