0

I am trying to run a program called Graphviz in the later stage of a PowerShell script I have to collect and create employee information to make an orgchart

script located here

in windows command prompt (cmd) it would be executed as like this

Create an SVG from DOT file:

dot -Tsvg -o path/to/out_file.svg path/to/file.dot

I may be overthinking this but I don't know how to execute a program in PowerShell with arguments

Thank you in advance

(comments on my script are welcome)

Crash893
  • 11,428
  • 21
  • 88
  • 123

2 Answers2

1

Adding double quotes to your script worked for me:

cmd.exe \c "C:\Program Files\Graphviz\bin\dot.exe" -Tdot abc.gv
sroush
  • 5,375
  • 2
  • 5
  • 11
0

I found that

    Invoke-Expression -Command "dot -rest of command here"

works.

And also, addressing Crash893's question in comments, variables can be used this way too

    Invoke-Expression -Command "dot -anoption $inputfile $outfile"
teleksterling
  • 76
  • 1
  • 4