bat文件不能运行一个.exe应用程序?

问题描述 投票:0回答:1

我试图从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

我到底做错了什么?

file batch-file
1个回答
0
投票

也许您目前不在 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

否则我就会怀疑那个文件是否真的在那个目录里了。

© www.soinside.com 2019 - 2024. All rights reserved.