How to make clickable julia script for Windows

question
windows

#1

This questions is more a windows question than a Julia one, so, I’m sorry if this is out of place.

Background

I’m taking a Computational Fluid Dynamics class, where we will be building a cfd code along the semester, and I convinced the professor to allow me to use Julia, although he doesn’t know the language.
Basically, as homework, every week I have to send small executables of part of the code, for example a routine that reads in neutral files and outputs vtk’s. And he will test it.
The problem is he uses Windows, and I haven’t touch a non-Unix machine for ages.
Originally he asked for us to send .exe files, but I don’t want to go to the hassle of compiling and building an executable. He will install julia on his laptop so he can run my scripts. So, finally my question:

TL;DR: Is there a way to make an “executable” julia script for Windows? Something like putting the #!/usr/bin/env julia in Unix machines.


#2

https://en.wikipedia.org/wiki/Batch_file ?


#3

Favba, I have a Windows 10 laptop with Julia 0.6.2 installed.
I can test run your submissions if it helps.


#4

Actually a better answer would be for you to prepare a Juyputer notebook,
and for your tutor to use that. Perhaps on a Juliabox account.


#5

I borrowed a Windows laptop from a friend and managed to do it.

First option: A Batch file, as @Liso suggested:

start C:\User\UserName\AppData\Local\Julia-0.6.2\bin\julia myscript.jl
end

But then I need to know the path to the julia executable beforehand.

A second option I discovered was, by clicking in a .jl file, Windows asks me for a program to open .jl files. I just set it to julia, and now I get exactly what I wanted: a clickable julia script.


Thanks for the suggestions, @John_Hearns! But I wanted to make this the least disruptive of the way he wanted(sending by email an executable) as possible. I’ll just send him a .jl file, ask him to set Julia as the program to open with, then every other .jl script I’ll send him will just work.


#6

Do you need to work with parameters (list of input and output files for example)?


#7

Not now, but I might eventually. In order to my second option to work, I guess I’ll have to write a script that prompts for the input, something like:

#myscript.jl

function main(input::String,output::String)
 do_stuff...
end

print("Please provide input file name: ")
const input = readline()
print("Please, provide output file name: ")
const output = readline()

main(input,output)