Search code examples
c#windowsscriptcscsx

Launch a .csx (scriptcs) C# script directly without opening a command line window


Is there a way in Windows to launch a .csx script directly (e.g. by double clicking the file, or from the start menu, or via an app launcher like Launchy) such that the script runs in the background without opening a command line window?

For example, say I have a simple "lowercase.csx" script which simply takes whatever text is in my clipboard, converts it to lowercase, and puts the result back in my clipboard. I want to be able to double click on that .csx file and have that run completely in the background without opening any kind of window.

Currently both ScriptCS.exe and the new csi.exe launcher that comes with VS2015 Update 1 will open a console window when running a .csx file, even if that file doesn't output anything to the console.

Note: I know that a new window isn't opened if you launch a script from a console window. What I want to to launch a script in a non-command line context and have it open no windows.

Note2: The equivalent of what I want in "CS-Script" (a ScriptCS alternative) is to launch the files using "csws.exe".


Solution

  • scriptcs does not support this. However there is an application that solves this problem: https://gitlab.com/Lions-Open-Source/ScriptCSW