How to run a .jl file on Windows 10?

I have installed Julia v 1.12.2 using the MSIX App Installer, as recommended. I can run REPL, using the command prompt.
But I can not run a .jl file: the extension is not recognised. Can someone give us the
step-by-step to solve this, for WIN10 ? Thank you.

In the Julia REPL, you can do include("myfile.jl") to run whatever code is in that file.

Thank you, but I want to run a file by double-clicking it, without the REPL. Before I removed my previous Julia, I could do it. But no longer.

Right-click a .jl file in File Explorer, select “Open with” > “Choose another app,” then “More apps” > “Look for another app on this PC.” Browse to julia.exe (typically in the bin folder), select it, check “Always use this app,” and confirm. This sets julia.exe as the default handler, running julia path\to\file.jl on double-click.

Disclaimer: I did not test this to see if it works; I do not currently have access to Windows.

I would discourage this based on tradition. Double-clicking source files typically opens a text editor, not run them like isolated executables, and the vast majority of .jl files are not intended for isolated execution and do not work if attempted. This is also far more limited than manually writing the julia command, its various switches, and arguments in the shell, or doing the same thing in a batch script that is often double-clicked to run. That said, you can do what’s convenient for you.

5 Likes

It’s preferable to associate the *.jl file extension with VS Code editor.
For double-clicking execution in Windows you may create a *.bat file with the following content:

@ECHO OFF
julia --startup-file=no "full path of *.jl file"
PAUSE