简体   繁体   中英

Batch file doesn't execute completely after other .exe is executed

I'm trying to create batch file which should have this commands:

cd "c:\Program files\NuSMV\2.5.2\bin\"
NuSMV -int short.smv
go
pick_state -r
print_current_state -v
simulate -r 3
show_traces -t
show_traces -v

The problem I encounter is this: after the second line is executed, NuSMV.exe runs in cmd and rest of the commands don't execute until I exit NuSMV, but I want to run commands 3-8 in NuSMV. What do I need to change in my .bat file. Thanks.

Put commands 3-8 in a text file (eg., cmds.txt), then run NuSMV as follows:

NuSMV -int short.smv -source cmds.txt

From the manual ( nusmv.pdf ) p.48:

It is also possible to make NUSMV read and execute a sequence of commands from a file, through the command line option -source: system prompt> NuSMV -source cmd file

Completing Vik answer, you can create the NUSMV commands file in the same BAT file

@echo off
pushd "c:\Program files\NuSMV\2.5.2\bin\"
echo go >"%TEMP%\cmds.txt"
echo pick_state -r >>"%TEMP%\cmds.txt"
echo print_current_state -v >>"%TEMP%\cmds.txt"
echo simulate -r 3 >>"%TEMP%\cmds.txt"
echo show_traces -t >>"%TEMP%\cmds.txt"
echo show_traces -v >>"%TEMP%\cmds.txt"
NuSMV -int short.smv -source "%TEMP%\cmds.txt"
del "%TEMP%\cmds.txt"
popd

Additionally I would recommend you to not change the current directory to NuSMV directory. Either editing the PATH, or just specifying NuSMV with its full path. In both cases you should then invoke the BAT from the current directory where short.smv is located.C

@echo off
echo go >"%TEMP%\cmds.txt"
echo pick_state -r >>"%TEMP%\cmds.txt"
echo print_current_state -v >>"%TEMP%\cmds.txt"
echo simulate -r 3 >>"%TEMP%\cmds.txt"
echo show_traces -t >>"%TEMP%\cmds.txt"
echo show_traces -v >>"%TEMP%\cmds.txt"
"c:\Program files\NuSMV\2.5.2\bin\NuSMV" -int short.smv -source "%TEMP%\cmds.txt"
del "%TEMP%\cmds.txt"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM