-
Notifications
You must be signed in to change notification settings - Fork 174
Question: how to execute scripts directly from the shell as if they were executables. #664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There is no way on Windows AFAIK, the documentation should explain that this is for Unix only. On Windows you can run |
aah I see. I misunderstood the documentation and thought it should be possible on windows too. Thanks for the quick answer! 👍 |
Hi! 👋
The documentation, in the section
https://github.com/filipw/dotnet-script#running-scripts
says that
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
Then it kind of works.
System.Console.ReadKey()
at the end of the script./helloworld.csx
from powershell, it does the same, it opens another CMD window and runs in there, to instantly close it afterwards.helloworld.csx
directly from the CMD, it works as intendedI 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 fileThanks in advance!
The text was updated successfully, but these errors were encountered: