This is an example of a Windows bat file to run Nastran for every *.dat file in the current folder. It also calculates the total Nastran execution time. Of course, you should change the path to nastran.exe. The nice thing here is that script uses variable set MyPath=%cd%, so you don’t need to enter the path for *.dat files Enjoy! 🙂

REM @echo off
@setlocal
set start=%time%
set MyPath=%cd%
del %MyPath%\*.f04
del %MyPath%\*.f06
del %MyPath%\*.log
del %MyPath%\*.xdb
del %MyPath%\*.rcf
for %%x in (*.dat) do K:\prod\wnt\Nastran\2016\bin\nastran.exe old=no scr=yes news=no mem=max parallel=2 %MyPath%\%%x
set end=%time%
set options="tokens=1-4 delims=:."
for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100
set /a hours=%end_h%-%start_h%
set /a mins=%end_m%-%start_m%
set /a secs=%end_s%-%start_s%

Discover more from Tips and Hints for Aerospace Engineers

Subscribe now to keep reading and get access to the full archive.

Continue reading