Need to create a batch file- I am new

Closed
bemarc - Dec 23, 2009 at 11:02 AM
 DB - Dec 27, 2011 at 12:01 AM
Hello,
I am new in using batch files. I was looking into the forum and in the web I did not found any useful information.
my first question is :
I have a lot of BDF file ( bulk Data file) that I need to run it with Nastran. I would like to create a simple batch file ( call file one by one and run it with Nastran). Any suggestion will be very helpfull.

the second one:

I need a batch file to extract result data from a lot of text file.

Thank you for your help
Related:

3 responses

Just open a notepad

Type the installation path of your nastran

Installation_drive\MSC.Software\MSC_Nastran\20101\bin\nastran.exe "Complete path of your file to be solved(including .filename.bdf)"

Similarily enter all the other files in the same format in the consecutive lines

Once this is done save the file and change the extension as .bat

Just run the .bat file

I will solve all the files in the order entered.
4
Richard.Williams Posts 25 Registration date Saturday November 7, 2009 Status Member Last seen July 18, 2012 14
Jan 5, 2010 at 04:36 PM
Here is an alternative. It will feed all .bdf files under folder "C:/path/to/bdf files" to nastran.


# Script nastran.txt
var str list, file
lf -n "*.bdf" "C:/path/to/bdf files" > $list
while ($list <> "")
do
    lex "1" $list > $file
    system nastran ("\"jid=\"+$file+"\"")
done


Script is in biterscripting. Save the script in file C:/Scripts/nastran.txt. Call the script by entering the following command in biterscipting.

script "C:/Scripts/nastran.txt"





Now, in terms of,

I need a batch file to extract result data from a lot of text file.


Can you please elaborate ?
3
Hi there,

Since I am not sure how Nastran works, I can help you to get the files one by one. Please find the script below,

Includes two batch file,

1. To list all the files into a text file
2. To keep removing the first line (first file name) from the txt file.

Note: For your purpose, you have to work with the first file name where I have commented using rem command before calling the second batch file

first batchfile:
-------------------
@echo off

if not exist ff.txt (for /f "tokens=* delims= " %%h in ('dir /b/s "C:\Documents and Settings\603389649\Desktop\test1" ^| find /v "*.dat"') do echo %%h >> ff.txt)

for /f "delims=" %%x in ('type ff.txt') do (
set h=%%x
goto hh
)

:hh
rem here I have printed the file name one by one
rem If you know how to use it with Nastran, use it here.
echo %date% %time% %h% >>file.txt
echo -------------------- >>file.txt

call dell.bat

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Second batch File: (dell.bat)

rem This is to remove the first line from a file

@echo off

for /f "skip=1 tokens=*" %%A in (ff.txt) do echo %%A >> d2.txt
del /q ff.txt
rename d2.txt ff.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please let me know if you have any problem
0
thanks For help
Jan 5, 2010 at 03:04 PM
Thanks fro Help, but it didn't work.

I called Nastran from command prompt and now I have to find out how to include all the input file name.

thanks again and I will let you know
0
hi
as I tried that you should run the nastran with .dat file and this .dat file must includ the .bdf file
but you need to learn how to creat the.dat file
0