Issue opening a layout via DopusRT in Powershell

I am having an issue opening a layout via DopusRT in Powershell I have tried a number of things, sadly nothing is giving.
I want to open a layout with the path of "automations\pureref panel"
In powershell I started with:
dopusRT /acmd Prefs LAYOUT="automations\pureref panel"
This only causes the preferences panel to open, trying the exacy same thing in CMD, opens the layout

I though this might have to do with this issue here HERE I tried variations of the solutions Leo proposed and sadly I still cant get it to work.

I tried:
dopusRT /acmd Prefs LAYOUT='"automations\pureref panel"'
dopusRT /acmd Prefs LAYOUT='automations\pureref panel'
dopusRT /acmd Prefs 'LAYOUT="automations\pureref panel"'

Help please.

Take the command that works in cmd.exe and stick a & (and space after it) at the start of it.

Strange that PowerShell makes running commands so complex, but also not surprising.

Try escaping the quotes with backticks:

dopusRT /acmd Prefs LAYOUT=`"automations\pureref panel`"

It's the / that's also causing a problem, which & fixes.

PowerShell has problems with arguments that start with /, <sarcasm>since those are really rare in Windows command-line tools.</sarcasm>

(Apparently you can also add --% after the exe name as an alternative.)

Yes, but somehow the command reached Opus. Opus then didn't like the way it received the string for the layout.

Looks like the proper way would be to launch this little monster:

Start-Process -NoNewWindow -FilePath "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" -ArgumentList "/acmd Prefs LAYOUT=`"automations\pureref panel`""

:crazy_face:

Might depend on the PS version, or due to me quoting the full exe path like you would on a normal Windows Command Prompt, but PS won't even launch the command for me without &, instead showing one of its wonderful error messages:

Works OK with & at the front.

Thank you guys for helping through with this:
@Leo
The & does not work, for both before and after:

& dopusRT /acmd Prefs LAYOUT="automations\pureref panel"
dopusRT /acmd Prefs LAYOUT="automations\pureref panel &"
& "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /acmd Prefs LAYOUT="automations\pureref panel"
"C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" /acmd Prefs LAYOUT="automations\pureref panel" &

Still only the preferences panel opens.

--% was one of the first things I tried earlier, a safety fall back for me but even that fails, no matter where I place it, the prefs panel opens.

@lxp
I tried your first suggestion of:

dopusRT /acmd Prefs LAYOUT=`"automations\pureref panel`"

same results as above.

I tried this bad boy:

Start-Process -NoNewWindow -FilePath "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe" -ArgumentList "/acmd Prefs LAYOUT=`"automations\pureref panel`""

I can cofirm it works but goodness its...

I will use it for now, maybe even build a powershell function that passes my arguments to its body, which consists of something like your example.

Leos stackoverflow link was really usefull as well, I was able to find an excellent tool that promises to solve these kinds of problems.
Solve Problems with External Command Lines in PowerShell
PowerShell execute command with arguments safely

I will spend some hours understanding it.

Hope this helps others that are fed up with Powershell parsing issues for Cli tools as well.

FWIW, here's the exact command I ran, which works for me:

But I've also seen wildly different behavior of other things with different versions of PowerShell, so maybe this is another one of those cases.

Ah, the = is also causing problems with PowerShell. I didn't include that when I ran things, which avoided that second issue.

2 Likes

Welp that does it :smiley:
Powershell is a really beatifull thing, for me, it changed the way I interface with my computer but this slopiness is unbecoming.

Thanks allot!