从批处理文件中调用另一个批处理命令会停止进一步执行
我在名为 scr 的文件夹中有一个 bat 脚本
/scr/
script.bat
test.txt
/folder/
testinfolder.txt
当我想复制与脚本位于同一文件夹中的 test.txt 时,我像这样使用 %~dp0
copy %~dp0test.txt test.txt
如果我想复制不在同一文件夹中的 testinfolder.txt 该怎么办文件夹作为运行脚本,但在文件夹内更深一层。我怎样才能复制该文件?我尝试过这个,但没有成功。
copy %~dp0/folder/testinfolder.txt testinfolder.txt
I have a bat script in a folder called scr
/scr/
script.bat
test.txt
/folder/
testinfolder.txt
When I want to copy test.txt which is in the same folder as the script, I use %~dp0 like this
copy %~dp0test.txt test.txt
What if I want to copy testinfolder.txt which is not in the same folder as the running script, but is one level deeper inside folder. How can I copy that file? I tried this, but it didn't work.
copy %~dp0/folder/testinfolder.txt testinfolder.txt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样
How about