在bat中直接使用绝对路径没有问题,但是文件传到其他地方时,绝对路径会发生改变,因此想通过使用相对路径来解决。

可以通过在bat获取当前bat所在的目录,然后cd 该目录来解决该问题

在bat前面增加如下两行:

set curdir=%~dp0
cd /d %curdir%

参考:

http://blog.csdn.net/mangmang2012/article/details/7048873

http://zpball.iteye.com/blog/983704

http://bbs.csdn.net/topics/320207805

相关文章:

  • 2021-06-18
  • 2021-09-13
  • 2022-02-21
  • 2022-01-24
  • 2022-12-23
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
猜你喜欢
  • 2021-11-25
  • 2021-04-27
  • 2021-08-12
  • 2022-01-16
  • 2021-10-10
相关资源
相似解决方案