【问题标题】:bat file not running an .exe application?bat 文件没有运行 .exe 应用程序?
【发布时间】:2020-08-22 20:16:29
【问题描述】:

我正在尝试从 bat 文件运行应用程序“VolumeReconstructor.exe”,但出现错误

'VolumeReconstructor.exe' is not recognized as an internal or external command, operable program or batch file.

代码如下:

echo off

::Folder path
set location=D:\pigs_december\Converted_Data\test_data\

::File names
set config_file=PlusConfiguration_mysequence.xml
set image_file=TrackedImageSequence_20191207_172327_ICE_3D_Cubes_Intervall_0_1008.nrrd
::set mask_file=mask.png
::set output_file=Output.nrrd

:: Path to the VolumeReconstructor.exe (PlusTookit --> bin)
cd C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\

:: with mask, but it does not work
::VolumeReconstructor.exe --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --importance-mask-file=%location%\%mask_file% --image-to-reference-transform=ImageToReference --verbose=4
VolumeReconstructor.exe --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --image-to-reference-transform=ImageToReference --verbose=4

pause

我做错了什么?

【问题讨论】:

  • 运行 dir C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\VolumeReconstructor.* 并发布(edit 你的帖子)结果。
  • 使用cd /D 而不是cd,以便在需要时也更改驱动器...
  • 谢谢大家!我让它工作了。添加绝对路径有效。

标签: file batch-file


【解决方案1】:

也许您当前不在c: 驱动器上。你需要这样做:

:: Path to the VolumeReconstructor.exe (PlusTookit --> bin)
cd /d C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\

:: with mask, but it does not work
::VolumeReconstructor.exe --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --importance-mask-file=%location%\%mask_file% --image-to-reference-transform=ImageToReference --verbose=4
VolumeReconstructor.exe --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --image-to-reference-transform=ImageToReference --verbose=4

但我可能会建议使用这样的绝对路径:

:: Path to the VolumeReconstructor.exe (PlusTookit --> bin)
:: don't bother to cd to the directory
:: cd C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\

:: with mask, but it does not work
::VolumeReconstructor.exe --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --importance-mask-file=%location%\%mask_file% --image-to-reference-transform=ImageToReference --verbose=4
"C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\VolumeReconstructor.exe" --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --image-to-reference-transform=ImageToReference --verbose=4

如果您更改任何内容以包含空格,您可能还需要对所有这些文件位置进行双引号以便将来兼容:

:: Path to the VolumeReconstructor.exe (PlusTookit --> bin)
:: don't bother to cd to the directory
:: cd C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\

:: with mask, but it does not work
::VolumeReconstructor.exe --config-file=%location%\%config_file% --source-seq-file=%location%\%image_file% --output-volume-file=%location%\%output_file% --importance-mask-file=%location%\%mask_file% --image-to-reference-transform=ImageToReference --verbose=4
"C:\Users\kristjan\PlusApp-2.9.0.20200316-Win64\bin\VolumeReconstructor.exe" --config-file="%location%\%config_file%" --source-seq-file="%location%\%image_file%" --output-volume-file="%location%\%output_file%" --image-to-reference-transform=ImageToReference --verbose=4

否则我不得不怀疑那个文件是否真的在那个目录中。

【讨论】:

  • 使用VolumeReconstrucor.exe 的绝对路径有效。谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-03-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多