Description
Hi! 👋
The documentation, in the section
https://github.com/filipw/dotnet-script#running-scripts
says that
Scripts can be executed directly from the shell as if they were executables.
How can I do that in Windows? I have tried, and the running ./helloworld.csx
opens Visual Studio Code for me.
I have tried both from CMD and PowerShell.
It makes sense it opens VS Code, since that's what it says if I right click > properties any .csx that they will open with.
If I change it to open with dotnet-script.exe instead, at the paths of
- C:/Users/username/.dotnet/tools/dotnet-script.exe
- or C:/ProgramData/dotnet-script/dotnet-script/dotnet-script.exe
Then it kind of works.
- if I double click it, it opens a cmd, runs the script and instantly closes. So I need to ad a
System.Console.ReadKey()
at the end of the script - if I run
./helloworld.csx
from powershell, it does the same, it opens another CMD window and runs in there, to instantly close it afterwards. - if I run
helloworld.csx
directly from the CMD, it works as intended
I can understand that if you run it with double click from the explorer, it closes as soon as it finishes. That makes sense.
But it would be nice if it could be run directly from the powershell, instead of opening the CMD.
Any thoughts on how to achieve that behaviour? The documentation I linked at the beginning explains nothing about it.
P.S: I have already tried adding the shebang #!/usr/bin/env dotnet-script
at the top of the file
Thanks in advance!