STAAD.Pro Help

I. Command Line Syntax

The following format is used when running STAAD.Pro from the command line interface.

Syntax

<path>\SProStaad\SProStaad.exe STAAD <input_file> [Options]

where:

ParameterDescription
<path> the installation path for STAAD.Pro, which is C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\ STAAD\ by default.
Tip: You can add " C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\ STAAD\SProStaad\ " to your Windows PATH environment variable to simply use the command SProStaad.
<input_file> the name of the STAAD input file you want to use as input.
Note: If the input file name includes spaces, you must use quote characters (") around the file name.
Expressions in square brackets (between '[' and ']') are optional, and can take one of the following values if used:
/s
Run silently and auto close at the end of run
/h
Run silently and hidden

Examples

The following is a simple example which can be run from a directory containing Example.std.

"C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\STAAD\SProStaad\SProStaad.exe" STAAD Example.std /s

When the analysis and design engine is complete, it will close as a result of using the 'silent' option. Otherwise, this window must be manually closed.

The following examples use shell or scripting languages to run a set of example input files through the STAAD Analysis & Design engine. Each of these will process all of the STAAD input files beginning with the string "US-" within the

Note: The use of the variables SProInst and USExamps are not necessary for any of these examples. They are used to demonstrate how to handle folder paths. If your installation folders differ from the default, the SProInst variable should be changed accordingly.

No additional windows will open while the analysis and design engine runs as a result of using the "hidden" option.

python Example

This python script makes use of the for statement to loops through the files.

The following can be saved as a python script (.py) in any text editor. This script does require the installation of python 3 as well as importing several common python libraries for use with file operations. Visit https://www.python.org/ for additional information about downloading, installing, and using python 3.

import os, subprocess, pathlib
# Create a new variable with the location of the SProStaad.exe file
SProInst="C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\STAAD\SProStaad"
# Add this to the system path variable for this session
os.environ["PATH"] += os.pathsep + SProInst + os.pathsep
# Create a variable to the default location of the STAAD US Example files; note the escaped 'U' in the path
USExamps= os.environ["PUBLIC"] + "\Documents\STAAD.Pro CONNECT Edition\Samples\Sample Models\\US"

for path in pathlib.Path(USExamps).glob('**/US-*.std',):
    subprocess.run(['SProStaad', 'STAAD', path, '/h'])
Tip: This is simply a python script to have STAAD run several files. If you want to use the OpenSTAAD API to perform more advanced operations within STAAD.Pro, refer to OS. Getting Started with Python.

Windows PowerShell Example

This PowerShell script makes use of the foreach statement to loop through the input files.

Tip: PowerShell will loop through these so rapidly that a Start-Sleep cmdlet is used to provide a brief pause for STAAD to run. You can vary the sleep time (in seconds by default) as needed for your machine.

The following can be saved as a PowerShell script (.ps1) in any text editor. PowerShell is installed on most current Windows systems by default, but if you need to install PowerShell or want to learn more about this scripting language, visit https://docs.microsoft.com/en-us/powershell/.

# Create a new variable with the location of the SProStaad.exe file
$SProInst="C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\STAAD\SProStaad"
# Add this to the system path variable for this session
$Env:PATH += ";$SProInst"
# Create a variable to the default location of the STAAD US Example files
$USExamps="$Env:PUBLIC\Documents\STAAD.Pro CONNECT Edition\Samples\Sample Models\US"

Set-Location -Path $USExamps
foreach ($file in Get-ChildItem $USExamps -Filter "US-*.std") {
    SProStaad.exe STAAD $file /s
    Start-Sleep 2 # this prevents the loop from runnig all the STAAD files nearly simultaneously
    Write-Output $file.Name
}

Batch File Example

This batch file makes use of the FOR statement to loop through the input files.

The following can be saved as a batch file (.bat) in any text editor.

::Create a new variable with the location of the SProStaad.exe file
SET SProInst="C:\Program Files\Bentley\Engineering\STAAD.Pro CONNECT Edition\STAAD\SProStaad"
::Add this to the system path variable for this session
SET PATH="%PATH%";%SProInst%
::Create a variable to the default location of the STAAD US Example files
SET USExamps="%PUBLIC%\Documents\STAAD.Pro CONNECT Edition\Samples\Sample Models\US"
        
FOR %%f IN (%USExamps%\US-*.std) DO (
    ECHO %%~nf
    SProStaad.exe STAAD "%%~nf.std" /h
)

EXIT /B