在Windows7上运行带参数的命令行应用程序的正确批处理文件语法是什么?
C:\KindleGen\kindlegen.exe Htmlpage.html -c2bat文件位于一个文件夹中,其中包含应处理的页面。
发布于 2013-07-13 22:54:04
Windows使用%1、%2等进行参数替换。
批处理文件test.bat包含:
c:\KindleGen\kindlegen.exe %1 -c2假设应始终应用-c2
调用它时使用:
test somefile.html 如果需要从图形用户界面运行,可以将.bat文件拖到桌面上并双击它。
如果要处理的文件总是相同的,那么您不需要命令行参数,只需将完整的命令行放在bat文件中:
c:\KindleGen\kindlegen.exe Htmlpage.html -c2如果您需要获取用户的文件名输入,您可以让.bat像这样请求它:
echo off
set /p fileName=Enter file name:
c:\KindleGen\kindlegen.exe fileName -c2
set /p done=Finished. Press enter...当您单击时,它将打开命令窗口并等待输入,运行命令,然后等待enter,然后关闭命令窗口。如果你想在完成后关闭最后一行,就去掉它。
如果您需要为当前文件夹中的所有.html文件运行该命令的脚本,请使用:
echo off
for %%c in (*.html) do c:\KindleGen\kindlegen.exe %%c -c2发布于 2013-07-14 02:44:52
尝试:
start "" "C:\KindleGen\kindlegen.exe" "Htmlpage.html" -c2https://stackoverflow.com/questions/17631240
复制相似问题