Starting STEP 7 with Preset Program, Block, and Network

David Krause17 min read
S7-400SiemensTutorial / How-to
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Starting STEP 7 with Preset Program, Block, and Network Line

Engineers commissioning large S7-400 fleets often want to open SIMATIC Manager directly to the block and network they need to inspect, not to the empty offline view. STEP 7 V5.x ships a small command-line interface that takes the project path, a block reference, an ObjectID, and a few behavioural flags. This reference documents the full switch set, decodes the path and ObjectID syntax, and supplies a working C# and PowerShell launcher for desktop tools, CMMS hooks, and CI scripts.

Scope. This article covers STEP 7 V5.x / SIMATIC Manager (the Classic engineering tool for S7-300/S7-400 and the legacy S7-200 add-on). It is not applicable to TIA Portal (S7-1200/S7-1500); for TIA Portal automation use the TIA Openness API instead.

Overview

SIMATIC Manager accepts a set of command-line switches that pre-select a project, a block within that project, and (with the right ObjectID) a specific network inside the block. The switches are documented in the integrated help under "Starting Step 7 with default start parameters" and revisited in the Siemens Programming with STEP 7 manual.

The four switches you will work with are:

  • /o <logical path> — opens the project, program folder, and block.
  • /h <ObjectID> — positions the cursor on a specific network/line using the object's internal ID.
  • /keep — re-uses an existing SIMATIC Manager instance instead of starting a new one.
  • /onl — opens the project in online mode (connects to the configured CPU).

Path and ObjectID can be used independently. The path alone opens the project at the block root, while the ObjectID is required to land on a specific network. Both path and ObjectID are stable for the lifetime of the project on disk; rename a station or move a block and you must regenerate the ObjectID.

Prerequisites

  • STEP 7 V5.4 SP5, V5.5, or V5.6 installed (V5.5 is the most common deployment target for S7-300/S7-400; V5.6 is required for the S7-400H and S7-400F/FH add-ons).
  • SIMATIC Manager reachable at %ProgramFiles(x86)%\Siemens\Automation\SIMATIC Manager\Step7\S7MANAG.exe (default install path).
  • An S7 project (S7-300, S7-400, S7-400H, S7-400F, WinAC, or ET 200 station) saved on a local or mapped network drive that SIMATIC Manager can resolve.
  • A project entry under HKCU\Software\Siemens\Automation\SimaticManager\Projects so SIMATIC Manager can resolve the project name to a file-system path. Opening the project once interactively populates this key.
  • For automation: .NET Framework 4.7.2+ or .NET 6/7/8 (Windows) with System.Diagnostics.Process. PowerShell 5.1+ (bundled with Windows 10/11) for the script example.
  • For the COM section: the STEP 7 V5.x SDK installed (S7API IDL and headers) and a development environment capable of importing COM type libraries.

Command-Line Switch Reference

Switch Argument Behaviour Notes
/o "[View ID,online ID]:project\…\object" Logical path that selects the project, S7-Program, and block to be opened. Quotes required when the path contains spaces or parentheses (almost always).
/h ObjectID (semicolon-delimited hex tokens) Positions the cursor inside the block at the network/line the ObjectID was generated for. ObjectID is generated by the SIMATIC Manager Create Shortcut action and varies per block.
/keep — Re-uses a running SIMATIC Manager instance instead of starting a new one. Documented but unreliable: the selected block is not always focused when the project is already open.
/onl — Opens the project in online mode (connects to the configured CPU). Also unreliable for cursor positioning; opening offline and going online manually is the field-proven workflow.
/h <id> /keep combined Passes the ObjectID to an existing instance. Requires the existing instance to have the same project already loaded, otherwise the ObjectID is ignored.

Logical Path Syntax and View/Online ID

The /o argument follows a fixed grammar. According to the STEP 7 help, the logical path has the form:

[View ID,online ID]:project name\{object name\}*\object name

Concretely, opening FB1 in S7-Program(1) of a project named MyConfig looks like this:

/o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1"

Each backslash-separated token is one level of the project tree:

  1. Project name — must match the folder name on disk and the name registered in the S7Proj registry entries.
  2. Station — SIMATIC 400(1) for a standard S7-400, SIMATIC 400H(1) for a redundant pair, SIMATIC 300(1) for an S7-300, SIMATIC PC Station(1) for WinAC, or an ET 200S/ET 200M/ET 200pro station name for distributed I/O.
  3. CPU — the rack slot name, e.g. CPU416-1, CPU315-2 PN/DP, CPU 412-3H for an H-CPU.
  4. Program folder — S7-Program(1) in the typical case. S7-Program(2) is created only if the project uses a second program (rare, mostly in PCS 7).
  5. Block container — Blocks for the standard block folder, or Sources for STL/SCL source files.
  6. Block name — e.g. FB1, OB1, DB10, FC100, UDT20, VAT1 (variable table), or an SFB/SFC reference.
MyConfig Project SIMATIC 400(1) Station CPU416-1 CPU S7-Program(1) Program Blocks Folder FB1 Block Network 5 Sub-target (optional) /o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1" /o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1\Network 5" /o "1,8:MyConfig\SIMATIC 300(1)\CPU315-2 PN/DP\S7-Program(1)\Blocks\OB1" /o "1,8:MyConfig\SIMATIC PC Station(1)\WinLC PN\S7-Program(1)\Blocks\FB100"
Quoting rule. The whole path must be wrapped in straight ASCII double-quotes (") when the project or station name contains spaces or parentheses. The hyphen in CPU416-1 and the slash in CPU315-2 PN/DP are normal characters and do not need escaping. Avoid smart-quote transliteration when the path is generated by a script.

Special targets inside a block

To pre-select a sub-object within a block (a single network inside FB1, for example), the path can be extended with a final segment:

/o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1\Network 5"

The trailing segment is matched by display name, not by index. If the network was renamed (e.g. Startup), the renamed name must be used. For S7-SCL sources inside the Sources folder, the same trick works with the source-file name as the trailing segment.

Path examples for common configurations

Configuration Logical path
S7-400 standard 1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1
S7-400 redundant (H) 1,8:MyConfig\SIMATIC 400H(1)\CPU 412-3H\S7-Program(1)\Blocks\OB1
S7-300 with PN/DP 1,8:MyConfig\SIMATIC 300(1)\CPU315-2 PN/DP\S7-Program(1)\Blocks\OB1
ET 200S slave 1,8:MyConfig\ET 200S(1)\IM151-1\S7-Program(1)\Blocks\FB10
WinAC PC station 1,8:MyConfig\SIMATIC PC Station(1)\WinLC PN\S7-Program(1)\Blocks\FB100
Variable table 1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\VAT1
S7-Graph source 1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Sources\FB200

View ID and Online ID

The [View ID,online ID] prefix on the path is an internal selector pair used by SIMATIC Manager to choose between the offline and online view of the same project. The two numbers are decimal indices assigned by SIMATIC Manager when the project is created:

  • View ID — selects the view level. 1 is the standard "Component view" used by almost every project. 2 exists for plant view in older PCS 7 configurations.
  • Online ID — selects the connection state. 8 is the offline database; 9 (or higher) is the online mirror that SIMATIC Manager populates when you click Go online.

For almost every S7-300/S7-400 workstation the prefix is 1,8. PCS 7 and WinCC projects can show 1,9 for online access. The prefix is fixed per workstation, not per project, and is stored in the shortcut that SIMATIC Manager creates from File → Create Shortcut.

To confirm the prefix on your own machine:

  1. Right-click a block in SIMATIC Manager and choose Create Shortcut.
  2. Right-click the new .lnk file, choose Properties, and read the Target field.
  3. The Target will contain the full command line including the prefix; the digits before the colon are the View ID and Online ID.

ObjectID Structure (/h)

The /h switch takes an ObjectID — a semicolon-delimited string that encodes the path from the project root down to a specific object (down to a network/line pair in extreme cases). The STEP 7 help example is:

/h T00112001;129;T00116001;1;T00116101;16e /keep

The ObjectID has the form:

T<8-hex-digits-of-project>;<type-code>;T<8-hex-digits-of-station>;<level>;T<8-hex-digits-of-object>;<hex-of-object>
Token Meaning Example value
T<8-hex-digits> Tree node ID — a stable hash assigned to each container (project, station, CPU, S7-Program, Blocks folder). T00112001, T00116001, T00116101
Decimal <type-code> Node type. Common values: 1 = project, 129 = station, 131 = CPU, 133 = S7-Program, 135 = Blocks folder, 137 = block. 1, 129
Decimal <level> Depth in the project tree. The same values as the type codes above; appears duplicated in the help example for redundancy. 1, 129
Hex <object-id> Object's own internal ID — often the block number or the line number offset. 16e (= 366 decimal — block 366, or a network 366 inside a large FB).

The ObjectID is not something you build by hand. The field workflow is:

  1. Open the project in SIMATIC Manager and navigate to the network you want a launcher for.
  2. Right-click the network title or block, choose Create Shortcut.
  3. Open the shortcut's Properties → Target and copy the entire /h argument (the digits after /h up to the next whitespace or /).
  4. Paste that string into your own launcher / script verbatim.
ObjectIDs are project-specific. The same block in two different projects will have two different ObjectIDs. If you move the block to a new folder, rename the station, or restructure the project tree, the ObjectID changes and any saved launcher breaks. Re-create the shortcut after major refactors.

/keep and /onl Behaviour

Field testing of the /keep and /onl switches consistently shows that they are not reliable for cursor positioning:

Switch Documented intent Observed behaviour Workaround
/keep If SIMATIC Manager is already running, pass the path to the existing instance instead of starting a new one. If the project is already loaded the target block is not selected. If a different project is loaded, neither the correct project nor the correct block is selected. Use a single-shot Process.Start with no /keep and let the user focus the existing window manually.
/onl Open the project in online mode and connect to the CPU. The correct block is not selected when /onl is used; in some builds the project does not open at all. Open the project offline with /o, let the editor land on the block, then click Go online in SIMATIC Manager.

Both behaviours may also be an interaction with missing View ID, Online ID, or ObjectID tokens — Siemens' help file leaves the relationship between /keep and the path syntax under-specified. Treat /keep and /onl as best-effort, not as contract. The /o + /h combination is the only one that consistently positions the cursor.

Step-by-Step: Building the Launch Shortcut

  1. Open SIMATIC Manager and load the target project.
  2. Navigate to S7-Program → Blocks → target block (e.g. FB1). If you need a specific network, click into that network so the cursor is on its title.
  3. Right-click the block or network title → Create Shortcut. SIMATIC Manager drops a .lnk on the desktop that contains a fully-formed command line.
  4. Right-click the shortcut → Properties → Shortcut and read the Target field. It will look like:
    "C:\Program Files (x86)\Siemens\Automation\SIMATIC Manager\Step7\S7MANAG.exe" /o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1" /h T00112001;129;T00116001;1;T00116101;16e
  5. Copy the full string and adapt it for your own launcher (C#, batch file, PowerShell, or a custom document management system). The /h argument can be dropped if network-level positioning is not required.
  6. Verify by double-clicking the shortcut; SIMATIC Manager must open with the requested block visible and the cursor on the network encoded in the ObjectID.
Run as user with project write access. The shortcut inherits the security context of the desktop user. If the project lives on a network share that requires different credentials, configure the shortcut's Run as different user property, or wrap it in a service that impersonates the correct account. The PG/PC interface (set via Control Panel → Set PG/PC Interface) must also point to the same network adapter the launcher's user is permitted to use.

C# and PowerShell Automation Examples

The following .NET 8 console snippet shows how to wrap the STEP 7 launcher so a custom tool (CMMS, dashboard, or CI script) can open a specific block on demand. It accepts the project name, station, CPU, S7-Program index, and block name as arguments, builds the logical path, and optionally appends the ObjectID captured from a pre-generated shortcut.

using System;
using System.Diagnostics;

namespace Step7Launcher
{
    internal static class Program
    {
        // Default SIMATIC Manager install path. Override with the first CLI argument
        // or via the STEPMANAGER_EXE environment variable.
        private const string DefaultSimaticManager =
            @"C:\Program Files (x86)\Siemens\Automation\SIMATIC Manager\Step7\S7MANAG.exe";

        private static int Main(string[] args)
        {
            if (args.Length < 5)
            {
                Console.Error.WriteLine(
                    "Usage: Step7Launcher.exe <project> <station> <cpu> " +
                    "<s7program-index> <block> [objectId] [subTarget]");
                return 2;
            }

            string project      = args[0];
            string station      = args[1];   // e.g. "SIMATIC 400(1)"
            string cpu          = args[2];   // e.g. "CPU416-1"
            string programIndex = args[3];   // usually "1"
            string block        = args[4];   // e.g. "FB1"
            string objectId     = args.Length >= 6 ? args[5] : null;
            string subTarget    = args.Length >= 7 ? args[6] : null; // e.g. "Network 5"

            // 1,8 is the standard offline component view for S7-300/S7-400.
            string blockPath = $"Blocks\\{block}";
            if (!string.IsNullOrEmpty(subTarget))
            {
                blockPath = $"{blockPath}\\{subTarget}";
            }

            string logicalPath =
                $"\"1,8:{project}\\{station}\\{cpu}\\S7-Program({programIndex})\\{blockPath}\"";

            string arguments = "/o " + logicalPath;
            if (!string.IsNullOrEmpty(objectId))
            {
                arguments += $" /h {objectId}";
            }

            string exe = Environment.GetEnvironmentVariable("STEPMANAGER_EXE")
                         ?? DefaultSimaticManager;

            var startInfo = new ProcessStartInfo
            {
                FileName        = exe,
                Arguments       = arguments,
                UseShellExecute = false,
                WorkingDirectory = Environment.CurrentDirectory
            };

            try
            {
                Process.Start(startInfo);
                Console.WriteLine("Launched: " + exe + " " + arguments);
                return 0;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Launch failed: " + ex.Message);
                return 1;
            }
        }
    }
}

Build and call it:

dotnet publish -c Release -r win-x64 --self-contained false
Step7Launcher.exe ^
  "MyConfig" "SIMATIC 400(1)" "CPU416-1" "1" "FB1" ^
  "T00112001;129;T00116001;1;T00116101;16e" "Network 5"

The same launch can be done from PowerShell with one line:

$exe = "C:\Program Files (x86)\Siemens\Automation\SIMATIC Manager\Step7\S7MANAG.exe"
$arg = '/o "1,8:MyConfig\SIMATIC 400(1)\CPU416-1\S7-Program(1)\Blocks\FB1" /h T00112001;129;T00116001;1;T00116101;16e'
Start-Process -FilePath $exe -ArgumentList $arg

For a persistent service that opens STEP 7 on demand, wrap the C# launcher in a Windows service or a Windows Communication Foundation (WCF) endpoint. The service should hold the ObjectID strings in configuration (not in code) so the launch definitions can be updated without redeploying.

Launch Methods Compared

Method Setup effort Cursor positioning Multi-user / DCOM Best for
Windows shortcut (.lnk) None — built from SIMATIC Manager Exact (uses captured ObjectID) No Engineer's desktop, click-to-open from a CMMS or dashboard
Command line with /o + /h Low — wrap in Process.Start Exact when /h is supplied No (launches in user session) Custom tools, CMMS, dashboards, CI scripts
PowerShell Start-Process Very low Exact with /h No Ad-hoc scripting, system administrator tooling
COM automation (Step7SrvOpen) High — requires STEP 7 SDK, IDL import Method-based selection, not ObjectID Yes (DCOM) Service-style apps, brokers, and remote engineering
TIA Openness (S7-1200/1500 only) High — separate API API-driven, more precise Yes TIA Portal projects (out of scope for STEP 7 V5.x)

COM Automation and SDK Notes

For deeper automation than the command line can provide, STEP 7 V5.x ships a COM automation layer. The type library is registered during the STEP 7 V5.x install and is described in the SDK under %ProgramFiles(x86)%\Siemens\Automation\SIMATIC Manager\Step7\S7API. The COM object supports (signature varies by service pack):

  • Opening an S7 project by file-system path with a flag controlling offline/online state.
  • Selecting an object inside the open project tree (analogous to the /o path).
  • Activating a specific block in the editor, optionally tied to an instance DB.

COM automation is the recommended path for service-style applications (an Openness-like broker, for example) because it survives SIMATIC Manager restarts and works over DCOM. References for the IDL definitions and C++ headers are bundled in the STEP 7 V5.6 SDK; managed wrappers can be built with tlbimp.exe and consumed from C# via System.Runtime.InteropServices. If only a launcher is needed, the command-line switches above are sufficient and avoid the COM dependency on the STEP 7 SDK.

Edge cases: H systems, F systems, distributed I/O

Topology Path adjustment Notes
S7-400H redundant pair (CPU 412-3H, 414-4H, 416-4H, 417-4H) Use SIMATIC 400H(1) as the station and the H-CPU name (e.g. CPU 412-3H). Online operations require the redundancy partner to be reachable; otherwise /onl fails.
S7-400F / S7-400FH safety PLC Use SIMATIC 400F(1) or SIMATIC 400FH(1) as the station. F-blocks (F-FB, F-FC, F-DB, F-OB) appear in the same Blocks folder; the path tokens are identical.
ET 200S / ET 200M / ET 200pro head module Use the head module's slot name (e.g. IM151-1, IM153-1) as the CPU token. Requires PROFIBUS-DP or PROFINET configuration in the parent project.
WinAC PC station Use SIMATIC PC Station(1) as the station and WinLC PN (or WinLC RTX) as the CPU token. Online connectivity is over the PC's network adapter; verify with Set PG/PC Interface.
Multi-project (PCS 7) Use the S7-project name as the project token; subordinate stations live under it. View ID can be 1 or 2 (plant view) depending on which tree you want to land in.

Troubleshooting and Verification

Symptom Likely cause Verification Fix
SIMATIC Manager opens to the offline root, not the requested block. Logical path is missing a \Blocks\ segment, or the project name does not match the disk folder. Compare the /o string with a freshly generated shortcut. Re-create the shortcut and copy the exact Target.
Block is opened but the cursor is at network 1, not the expected network. ObjectID is wrong, or the block was refactored and the network moved. Right-click the target network → Create Shortcut and compare the /h string. Copy the new ObjectID from the freshly generated shortcut.
SIMATIC Manager does not start at all; error "Windows cannot find 'S7MANAG.exe'". Wrong install path or 32/64-bit redirection issue. Inspect %ProgramFiles(x86)%\Siemens\Automation\SIMATIC Manager\Step7 for S7MANAG.EXE. Override the executable path via the STEPMANAGER_EXE environment variable or your launcher's config.
Different project opens than requested. Another SIMATIC Manager instance already had a project loaded and the /keep / no-arg conflict resolved the wrong project. Check the Windows taskbar for an existing S7MANAG.EXE process before launch. Kill the existing instance, or remove /keep from the command line.
"Project not found" error after a recent refactor. Project was moved, renamed, or removed from the S7Proj registry key. Open SIMATIC Manager interactively and check the project list under File → Open. Re-open the project once interactively so the registry entry is refreshed.
Online mode requested but the project opens offline. /onl is unreliable in current builds; the PC also has no physical or routed connection to the CPU. Check Set PG/PC Interface and the accessible nodes list. Open offline with /o, then click Go online manually.
Path with parentheses causes parser error. Quotes were dropped or escaped incorrectly when the path was embedded in a script. Echo the command line in your launcher and verify the quotes around the path. Wrap the path in straight ASCII double-quotes (") and avoid smart-quote transliteration.
ObjectID token count does not match the help example. The shortcut captured a different object depth (e.g. a UDT reference instead of a block). Re-create the shortcut from the same starting node and compare token-for-token. Use the shortest ObjectID that successfully lands on the target — extra tokens usually indicate an over-specific capture.
Launcher runs under a service account; SIMATIC Manager starts but cannot open the project. The service account has no S7Proj registry entry and no permission on the project share. Check the registry under HKCU for the service account via psexec -s regedit. Pre-populate the registry key for the service account, or launch SIMATIC Manager as the engineer instead.

Verification checklist

  • SIMATIC Manager opens within 5 seconds of the launcher invocation.
  • The project name in the title bar matches the requested project.
  • The block editor pane shows the requested block (FB1, OB1, etc.).
  • The cursor is on the network encoded by the ObjectID, or on network 1 if no ObjectID was supplied.
  • No error dialog appears in the SIMATIC Manager session.
  • Closing the editor and clicking the same launcher again opens the same block at the same network.

For permanent CI hooks, capture the SIMATIC Manager process ID with Process.GetProcessByName("S7MANAG") and assert it returns one row shortly after launch. PowerShell equivalent:

Start-Process -FilePath $exe -ArgumentList $arg -PassThru |
  ForEach-Object { Start-Sleep -Seconds 3; (Get-Process -Id $_.Id).MainWindowTitle }

FAQ

What are the View ID and Online ID in the STEP 7 path?

They are decimal indices that pick the project view and the offline/online database. For almost every S7-300/S7-400 workstation the values are 1 (component view) and 8 (offline database). PCS 7 and WinCC projects can use 1,9 for online access. The prefix is fixed per workstation, not per project, and is captured automatically in any shortcut you create from SIMATIC Manager.

Why does /keep not focus the requested block?

Field testing shows that /keep re-uses the running SIMATIC Manager instance but does not always switch the active project or focus the target block. Use a single-shot Process.Start without /keep and let the user focus the existing window manually, or close the existing instance before launch.

Can I open STEP 7 at a specific network line?

Yes, but you need an ObjectID captured from a real shortcut: in SIMATIC Manager right-click the network title → Create Shortcut, open the shortcut's Properties → Target, and copy the /h argument. ObjectIDs are project- and refactor-specific, so re-generate them after moving or renaming blocks. As a simpler alternative, append \Network <n> to the block name in the /o path; networks are matched by display name.

Which STEP 7 versions support the command-line switches?

The switches are present in STEP 7 V5.4 SP5, V5.5, and V5.6. Earlier V5.4 service packs do not always accept the /h ObjectID syntax. TIA Portal (S7-1200/S7-1500) does not use this command-line interface; use the TIA Openness API there.

Is there a way to script STEP 7 without writing a C# launcher?

Yes. A plain batch file or PowerShell script can call S7MANAG.EXE with the same arguments, and the COM interface exposed by the STEP 7 V5.x SDK supports project open, object select, and block activate operations for service-style automation. For TIA Portal projects the only scripted route is the TIA Openness API.

Back to blog