批量在cp路径中添加其他\

时间:2017-08-01 09:41:33

标签: windows batch-file path

我编写了一个批处理脚本,它正在为var user = {first: "john", last: "doe"}; var details = {car: 'corolla', color: 'silver'}; user.details = details; console.log(user);创建项目,并希望创建带有svn的文档,然后将其复制到分支路径中。

我这样做的部分是:

sphinx

此操作因ECHO ##### Creating Docs Branch %VERSION% cd %~dp0\trunk\Python\MyPackage\docs call make html cp -r _build\html %~dp0\branches\%VERSION%\Python\docs\MyPackage svn add %~dp0\branches\%VERSION%\Python\docs\MyPackage svn commit %~dp0\branches\%VERSION%\Python\docs\MyPackage -m "Added Docs Branch %VERSION%"

而失败

显然在cp: cannot mkdir "D:/00_Workspace/MyProject/MyPackage//branches/1.1.0/Python/docs/MyPackage": Path could not be found/之间添加了第二个MyPackage 为什么会这样?

以下是branches

的完整版本
batch

1 个答案:

答案 0 :(得分:1)

正如@elzooilogico所说

  

%~dp0包含驱动器号以及运行脚本的路径以反斜杠结束。使用svn add %~dp0\branches\%VERSION%\Python\docs\MyPackage和所有类似路径更改svn add %~dp0branches\%VERSION%\Python\docs\MyPackage

应该有用。