2011-12-23 201 views
0

如果我用Visual Studio 2010(在bin/Debug文件夾中)創建一個.exe文件,是否可以使用bat文件來啓動該程序?蝙蝠文件 - 找不到.exe

我試過低於我的bat文件:

start "c:\Services\ServicesChecker\ServicesChecker\bin\Debug" ServicesChecker.exe 

但是當我運行它,它說,Windows無法找到ServicesChecker.exe即使如果我瀏覽到該位置,我可以看到它?

回答

4

在您的命令中,"c:\Services\..."是窗口的標題,並不用於查找可執行文件。

嘗試:

start c:\Services\ServicesChecker\ServicesChecker\bin\Debug\ServicesChecker.exe 
+2

+1 - 你輸入的比我快! – ChrisBD 2011-12-23 12:20:15

+0

@aix - 乾杯 - 另一件事 - 如果我想傳遞參數給這個程序,你知道我怎麼能在.bat文件中做到這一點(即 - 該prgoram會期望一些字符串和一個int進來 - 謝謝 – 2011-12-23 12:24:52

+1

你可以在exe後輸入參數值,例如ServicesChecker.exe arg1 arg2 – 2011-12-23 12:31:56

1

儘量只使用文件路徑,而不是start,你需要在同一個引用路徑文件名,例如:

"c:\Services\ServicesChecker\ServicesChecker\bin\Debug\ServicesChecker.exe" 
2

其原因是開始時沒有選項可以指定路徑。

使用

start "c:\Services\ServicesChecker\ServicesChecker\bin\Debug\ServicesChecker.exe" 

這應該工作。