How to open a graphics file on Windows using run()


#1

On macOS I can do this:

run(`open $(filename)`)

where filename might be image.png or /tmp/test.pdf or /Users/me/test.svg, and the file will open in Preview or Safari or whatever app you’ve decided to make the default for that type of image.

What’s the equivalent on Windows?


#2

You could try:

run(`explorer $filename`)

Maybe want to ignore the return status:

run(ignorestatus(`explorer $filename`))

#3

Thanks, Greg, I’ll try this.


#4

What do you try to display?


#5

Hi,
and please what is the version of this for Linux?


#6

Perhaps xdg-open ?

run(`xdg-open $(filename)`)

?


#7

Thanks, I’m on Windows and have only Winbuntu that has no graphical x11 tools but it suggested me to install it. So it probably works.

I dis ask this because I want to cover the 3 OSs and lacked the linux version.