bat文件中使用相对路径传参数给一个exe,cmd中运行bat展示找不到文件

bat文件中使用相对路径传参数给一个exe,cmd中运行bat显示找不到文件
本帖最后由 ta_xue_xun_mei 于 2014-09-02 22:27:10 编辑
使用的exe文件是在如下地址找到的:
http://itsme.home.xs4all.nl/projects/xda/tools.html
我使用的是pget.exe。用来从WinCE系统复制文件到Win7系统。
我在bat文件中注明相对路径,用cmd调用bat。bat把参数传给pget。
但是在cmd中运行bat时,显示找不到文件。
@echo off
if not exist docu md docu\xmls
pget -f \Flashdisk\docu\xmls\anlagen.xml "docu\xmls"

前面的部分是想要复制的文件在winCE中的相对路径,后面的部分是文件期望复制到的win7的相对路径。
该错误只在绝对路径包含c:/Program Files (x86)/时出现。所以我推断是因为win7的补全后的绝对路径中有空格的原因。
可是我不知道如果我在bat中一定要用相对路径,那么如何操作它前面补全成绝对路径的部分才能不受空格的影响呢?

以下是readme中对pget的描述:
引用
pget.exe

Tool to copy files from your CE device to your local machine.
you may use wildcards or multiple filenames to specify the source files.
you may specify a directory for the target, if no target is specified
it will default to the current directory.
Example: 'pget \Windows\toolhelp.dll'  will copy toolhelp.dll to the current directory.

This tool currently does not allow you to copy certain ROM files. see 'dumprom' for that.

pget also supports %CSIDL style variables.
you can recursively copy all copyable files using pget -r


 

------解决方案--------------------
试试转换成绝对路径呢
------解决方案--------------------
@echo on
if not exist "%~dp0docu" md "%~dp0docu\xmls"
pget -f \Flashdisk\docu\xmls\anlagen.xml "%~dp0docu\xmls"
pause

试试
把执行过程发出来看看
------解决方案--------------------
或者试试先复制到当前目录然后再移动到指定目录
@echo on
if not exist "%~dp0docu" md "%~dp0docu\xmls"
pget -f \Flashdisk\docu\xmls\anlagen.xml
move /y anlagen.xml "%~dp0docu\xmls"
pause

把执行过程发出来看看