Batch file 如何将配置文件传递到bat文件中的exe?
我已经在我的计算机上的同一目录中安装了test.exe(控制台应用程序/windows应用程序)和Batch file 如何将配置文件传递到bat文件中的exe?,batch-file,exe,Batch File,Exe,我已经在我的计算机上的同一目录中安装了test.exe(控制台应用程序/windows应用程序)和test.exe.config 当我打开DOS提示符时,我能够运行test.exe%1%2%3,它成功地将数据插入MS SQL表中 test.exe.config是从app.config编译而来的,其中包含以下内容: <connectionStrings> <add name="Common Instance" connectionString="data source=eeeee
test.exe.config
当我打开DOS提示符时,我能够运行test.exe%1%2%3
,它成功地将数据插入MS SQL表中
test.exe.config是从app.config编译而来的,其中包含以下内容:
<connectionStrings>
<add name="Common Instance" connectionString="data source=eeeeee;Integrated Security=SSPI;Initial Catalog=YYYY;User ID=xxx;Password=xxxx" providerName="System.Data.SqlClient"/>
</connectionStrings>
我在数据库上放了一个跟踪,当我运行bat文件时,它甚至没有被击中
似乎当我运行bat文件时,它找不到数据库连接
我试过:
START C:\aa\test.exe%1%2%3“test.exe.config”
START C:\aa\test.exe%1%2%3/config:test.exe.config
START C:\aa\test.exe%1%2%3/config:App.config
它们都不起作用。我希望有一些提示。我的猜测是需要在批处理文件中设置工作目录。这就是它找不到
.config
文件的原因。将工作目录设置为应用程序和.config
文件所在的文件夹
cd C:\aa
start test.exe %1 %2 %3
cd C:\aa
start test.exe %1 %2 %3