Table of Contents

Quotes and paths

Quote paths and values containing spaces. The application launching PDMShell parses its arguments first, then PDMShell parses the command. For complex commands, save the commands in a .pdmshell file and pass the script path instead of embedding several layers of quotes.

Start a script from Windows

From cmd.exe, use your installed executable path:

"C:\Path\To\pdmcli.exe" "C:\Scripts\Inspect parts.pdmshell"

From PowerShell, use Start-Process when you need to wait and read the exit code:

$process = Start-Process -FilePath "C:\Path\To\pdmcli.exe" -ArgumentList '"C:\Scripts\Inspect parts.pdmshell"' -Wait -PassThru
$process.ExitCode

The single-quoted PowerShell string preserves the double quotes around the script path. End the script with quit -silent when it should close the standalone process. See RUNSCRIPT exit codes.

Write commands inside the script

Quote each path or value as needed:

fileinfo -filePath "C:\Vault\Parts\Mounting plate.sldprt"
setvar -filePath "$localPath" -variableName Description -value "Plate 3/\"1"

Inside a quoted PDMShell value, \" represents a literal double quote. In a plain-text script, $localPath remains a PDMShell placeholder; it is not a PowerShell variable.

Expressions containing quotes

When the entire parameter value is a ${...} expression, you can write it without outer quotes, even when its arguments contain spaces:

setglobal -name "SupersededDocID" -value ${regex("$(swm_SupersededOIN)", "(?<=^.{3}).*")}

If the current file's swm_SupersededOIN value is OIN12345, this stores 12345. The visual editor loads the complete expression as one value.

In the visual parameter field, enter just the expression:

${regex("$(swm_SupersededOIN)", "(?<=^.{3}).*")}

The editor handles command-level quoting when saving. Its readable script view shows the expression's normal quotes; Raw script and Copy executable script can show the escaped form:

setglobal -name "SupersededDocID" -value "${regex(\"$(swm_SupersededOIN)\", \"(?<=^.{3}).*\")}"

Both forms preserve the same expression value. You do not need to remove the editor's generated quotes to run the script. Use straight quotes ("), not typographic quotes (“ and ”).

For a fixed three-character prefix, substring is another option:

setglobal -name "SupersededDocID" -value ${substring("$(swm_SupersededOIN)", 3)}

These examples require a current file with the data-card variable. They extract text; they do not verify that the resulting ID identifies an existing file.

Dispatch and workflow actions

Put the executable path in the action's executable field and the arguments in its parameters field. Use the examples in Dispatch or workflow transitions. Do not copy the entire shell command, including its executable, into the parameters field.

Keep startup switches such as -single outside quoted paths. Instance reuse does not provide the executing script's exit code to the forwarding process; see startup modes.