2
考虑到参数是相对于当前目录的文件路径,我如何才能将参数设置为bat文件的目录?BAT文件:参数路径
比如我有以下文件:
C:\folder1\mybat.bat
C:\folder2\x.jpg
from C:\ I run: folder1\mybat.bat folder2\x.jpg
Now I want to get: C:\folder2 because that's the folder of x.jpg
from C:\folder1 I run: mybat.bat ..\folder2\x.jpg
Result is the same as above
from C:\folder2 I run: ..\folder1\mybat.bat x.jpg
Result is again the same, the folder of x
你检查出[的Windows PowerShell(http://en.wikipedia.org/wiki/Windows_PowerShell)呢?它比批处理文件或命令提示符强大得多。 – TrueWill