批处理如何运行带文件路径参数的exe

clever101
博客专家认证
2013-11-12 11:22:00
一个批处理文件这样运行程序:


@echo off

start "%~dp0outdir\Debug\MyApp.exe" "%~dp0outdir\config\MyApp.xml"


%~dp0outdir\config\MyApp.xml为MyApp.exe的运行参数。MyApp.exe是和批处理文件的同一级文件夹下outdir的子文件夹Debug里面。MyApp.xml是和批处理文件的同一级文件夹下outdir的子文件夹config里面。但是实际上这样运行并不能读取参数MyApp.xml。请问如何写才能运行带文件路径参数的exe呢?
...全文
798 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
clever101 2013-11-14
  • 打赏
  • 举报
回复
引用 3 楼 zd870905 的回复:
start 会将后面第一对"中间的内容作为标题栏,可以使用 /d 来指定路径,或者直接使用一对空" start "" "%~dp0outdir\Debug\MyApp.exe" "%~dp0outdir\config\MyApp.xml"
兄弟,这样不行啊!
alexzshl 2013-11-12
  • 打赏
  • 举报
回复
其实不使用start也是可以的,start其实针对的是bat程序,对于普通的程序不需要start
alexzshl 2013-11-12
  • 打赏
  • 举报
回复
start 会将后面第一对"中间的内容作为标题栏,可以使用 /d 来指定路径,或者直接使用一对空" start "" "%~dp0outdir\Debug\MyApp.exe" "%~dp0outdir\config\MyApp.xml"
clever101 2013-11-12
  • 打赏
  • 举报
回复
引用 1 楼 ljc007 的回复:
用 /d 选项试试 START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B] [command/program] [parameters] "title" Title to display in window title bar. path Starting directory.
呵呵,大侠,给个使用示例吧!
ljc007 2013-11-12
  • 打赏
  • 举报
回复
用 /d 选项试试 START ["title"] [/D path] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL] [/NODE <NUMA node>] [/AFFINITY <hex affinity mask>] [/WAIT] [/B] [command/program] [parameters] "title" Title to display in window title bar. path Starting directory.

18,124

社区成员

发帖
与我相关
我的任务
社区描述
Windows客户端使用相关问题交流社区
社区管理员
  • Windows客户端使用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧