CS-Script 3.20.0


Script library

Note that starting from v3.5 script library split on the default set of samples, which is distributed by default with the CS-Script suite and extended set of samples, which can be downloaded as part of theExtension Pack from CS-Script Home Page.    

The script library is located in the cs-script/Lib folder (see Integration with OS for details). It contains a number of assemblies and scripts required for CS-Script to function properly (e.g. allow script debugging) and the scripts that are just useful for being imported by other scripts. All scripts from the cs-script/Lib folder are automatically available for importing (see Importing scripts ) and execution from command prompt.

The installation package also contains the sample script library (cs-script/Samples folder). This library is just a collection of the very simple script samples.

For script usage information execute the following command in command prompt:

cscs <script name> /? 

cs-script/Lib:

Note: the number of scripts may very from version to version

Script file Description
code.cs Executes C# statement with optional referenced namespaces. 
Example: cscs code MessageBox.Show(\"test\")
cutFile.cs Cuts file in pieces and prepares a batch file to reassemble the original file.
Note: No script is required to reassemble the original file.
SimpleEncryption.cs This script contains handy encrypting routines and can be imported to assist with implementation of any encryption/decryption tasks.
The original file was kindly provided by DotNetThis and can be downloaded from http://www.codeproject.com/dotnet/dotnetcrypto.asp.
encrypt.cs Encrypts/Decrypts('/d') content of the file and saves it to another file.
scramble.cs Shifts all bytes in the file. This is a very primitive form of file obfuscation.
smtpMailTo.cs Sends e-mail to the specified address (use "" for local SMTP server).
Example: cscs "" user@domain "Test subject" "This mail was sent by CS-Script." 
feedback.cs Prepares feedback e-mail and loads it into default e-mail client.
bug.cs Prepares the bug report e-mail and loads it into default e-mail client.
isolate.cs Isolates the script and all it's dependencies in the separate folder for further deployment.
Converts the script into standalone Visual Studio 2003 C# solution.
verify.cs Verifies if the script file can be compiled.
who.cs Prints information about current login session. Can be used even from services.
This is an example of the use of Terminal server API from C# code.
debug#D.cs Loads the C# script file into the temporary SharpDevelop project and opens it.
Installs/Uninstalls ShartDevelop shell extension.
debugCLR.cs Loads the C# script file into the temporary MS CLR Debugger (DbgCLR.exe) project and opens it.
Installs/Uninstalls CLR Debugger shell extension.
debugVS7.1.cs Loads the C# script file into the temporary VS 7.1 C# project and opens it.
Installs/Uninstalls VS 7.1 shell extension.
debugVS8.0.cs Loads the C# script file into the temporary VS 8.0 C# project and opens it.
Installs/Uninstalls VS 8.0 shell extension.
libhelp.cs  Prints help for all C# scripts (.cs files) in the cs-script\lib and cs-script\samples directory.
help.cs Displays the CS-Script Help.
cmdShell.cs Creates a shell extension "Cmd". This extension allows to open command-prompt pointing to the directory where 'right-clocked' file is.
credentials.cs Prompts and collects the user login information.
config.cs This script displays CS-Script configuration console.
configFile.cs This script displays CS-Script configuration file editor.
CSSCodeProvider.cs This script contains implementation of the alternative CodeDomProvider. It is to be used (in form of compiled assembly CSSCodeProvider.dll) with CS-Script engine to provide alternative code compilers to run non-C# scripts.
cfbuild Compiles script file into executable for Pocket PC.
update.cs Checks for available update on the CS-Script home page.
which.cs Verifies which copy of the executable file would be executed if invoked from command-prompt.
print.cs This script contains general purpose printing routines and can be imported to assist with implementation of any printing tasks.
com.cs Converterts type library of the COM Server to assembly.
wsdl.cs This script generates C# code for Web Service client from the given Web Service URL.
css2ws.cs This script converts the C# script into WebService on the local WebServer.
ccs2cs.cs This script converts the cassless C# into standard C#.
clearCache.cs Deletes all compiled script files (.csc) from the ScriptLibrary directory. Use this script if version of of target CLR is changed.
ver.cs Prints version of the OS, CLR CS-script environment.
runas.cs Starts process as a specified (user is prompted for password) user.
nkill.cs Terminates processes specified as arguments
netpath.cs Sets %WINDOWS%\\Microsoft.NET\\Framework\\<current version> to the system PATH for the current process.
shortName.cs  Convert and prints 8.3 version of the path.
createShortcut.cs Creates execution shortcut to the script file.
clearTemp.cs Deletes all temporary files created by the script engine.
lib.cs Shows Script Library content.
CSSCodeProvider.cs Source code for the custom compiler CSSCodeProvider.dll
soapsuds.cs Generates C# code for WebServiceClient
searchDirs.cs This script displays list of the CS-Script search directories for script file and assembly probing. It also allows adding the search directory from command-prompt.
elevate.cs This script is to be used as a pre-script in the primary script code to ensure elevated execution. Example: //css_pre elevate();
startElevated.cs Starts script as an elevated process.
asadmin.cs  script alias for startElevated.cs
Vista.cs This script is to be imported/included by other scripts. To resturt the script execution as an elevated process .
debug2005.csl script alias for debugVS8.0.cs
cache.cs Opens the cahce directory for a given C# script file.
verify2.cs Verifies if script file can be compiled. Allows for reverification without stopping the script execution.
linq.includes.cs This script contains references to all assemblies required for programming against LINQ. This script allows reference multiple assemblies from the primary script with a single line statement (e.g. //css_includelinq.includes.cs;). 
res.csGenerates .resources file.
silvelight.csSilverlight XAP file viewer.
noCache.csExecutes script without using script cache even if it is available.
fkille.csDeletes (kills) file(s). If file is locked by some process it will wait until file is released and than kill it
wwf.includes.cs This script contains references to all assemblies required for programming against WWF. This script allows reference multiple assemblies from the primary script with a single line statement (e.g. //css_include wwf.includes.cs;). 
wpf.includes.cs This script contains references to all assemblies required for programming against WPF. This script allows reference multiple assemblies from the primary script with a single line statement (e.g. //css_include wpf.includes.cs;). 

cs-script/Samples:

Note: the number of scripts may very from version to version

Script file Description
cutFile.cs Cuts the file into pieces and prepares the batch file to reassemble the original file.
Note: No script is required to reassemble the original file.
exportData.cs Exports data from the SQL Server table to the specified file.
importData.cs Imports data from the specified file to the SQL Server table. First row in the file is a list of filed names. 
getOptusUsage.cs Gets Optus (www.optusnet.com.au) data usage. Optionally connects with the proxy authentication.
geturl.cs Saves the URL text to a file. Optionally the proxy authentication can be used.
google.cs Performs online search by using the Google search engine.
The original file was provided by Brian Delahunty article "Introduction to Mono
- Your first Mono app" (http://www.codeproject.com/cpnet/introtomono1.asp).
hello.cs The canonical "Hello world!" script.
hello.cpp The "Hello world!" script (C++/CLI syntax).
hello.jsThe "Hello world!" script (JavaScript syntax).
importTickScript.cs Imports and executes 'tick.cs' script. 
tick.cs Counts a specified number of seconds (default is 5 sec). This script is used in the importTickScript sample. 
nkill.cs  Terminates specified processes.
print.cs This script contains general purpose printing routines and can be imported to assist with implementation of any printing tasks.
printScreen.cs Captures a screen image and saves it to a file (default file: screen.gif). 
progressbar.cs Shows 'continuous' progressbar. This is an example how to draw in GDI+ without flickering.
reflect.cs Prints assembly reflection info.
ErrorLevelTester.csDemonstrates how to set errorlevel from the script and interprete it from the batch file.
The example contributed by Sten Frostholm.
msxml.cs This is the example of using a COM server (MS XML Parser) from the C# script.
runScript.cs Runs another script in a background.
smtpMailTo.cs Sends e-mail to the specified address (use "" for local SMTP server).
Example: cscs "" user@domain "Test subject" "This mail was sent by CS-Script."
synTime.cs Gets time from http://tycho.usno.navy.mil/cgi-bin/timer.pl and synchronises PC system time.
winForm.cs The primitive example that demonstrates how to create a WinForm application.
sysFindConfig.cs Displays a configuration console to adjust system 'FindInFile' options on WindowsXP. This is the work around for WindowsXP BUG described in MSDN articles Q309173 'Using the 'A Word or Phrase in the File' Search Criterion May Not Work'.
setEV.cs This script allows setting environment variable permanently by using WScript.Shell COM object usually available from VBScript.
ReflectScript.cs
Example of how in the script to obtain the information about the script itself (e.g. script file name).
unsafe_keyword.cs
Example of using keyword "unsafe", which requires special value to be passed to the C# compiler.
googleWebService.cs Script that performs Google search using Google API (WebService).
WCF\service.cs Script which implements WCF (.NET 3.0) service server.
WCF\service.cs.config App.config file for running WCF\service.cs
WCF\client.cs Script which implements WCF service client.
WPF\Hello.cs The "Hello world!" script which utilizes WPF functionality (.NET 3.0).
WPF\Hello.xaml The "Hello world!" script XAML file, which is requiered for running WPF\Hello.cs.
Resources\script.csDemonstrates how to embedd binary file into the script assembly
Remoting\server.cs      Script which implements .NET Remoting server.
Remoting\ClientConsole.cs     Script which implements .NET Remoting console client.
Remoting\ClientForm.cs     Script which implements .NET Remoting WinForm client.
Vista\VistaUAC_code.cs Example of Vista process elevation from the script code by calling the elevation routine.
Vista\VistaUAC_command-line.cs Example of Vista process elevation from command-prompt.
Vista\VistaUAC_pre-script.cs Example of Vista process elevation from the script code by having the script engine directive //css_pre.
linq.csExample of using LINQ in scripts
Hosting\HostingSimplified\Hello.cs    
HelloWorld style example of script hosting.
Hosting\HostingSimplified\Host.cs
Example of the host application for two-way communication between the host and the script hosting scenario. Type implemented by script is accessed with Reflection.
Hosting\HostingSimplified\Script.csExample of the script for two-way communication between the host and the script hosting scenario. Type implemented by script is accessed with Reflection.
Hosting\InterfaceAlignment\Host.csExample host application using Interface Alignment (DuckTyping) technique.
Hosting\InterfaceAlignment\HelloScript.csExample script using Interface Alignment (DuckTyping) technique.
Hosting\HostingWithInterfaces\Host.cs
Example of the host application for two-way communication between the script and the host scenario. Type implemented by script is accessed through an interface.
Hosting\HostingWithInterfaces\Script.csExample of the script for two-way communication between the host and the script hosting scenario. Type implemented by script is accessed through an interface.
Hosting\CompileErrors.cs Example of retrieving the detailsed information about the script compiletion error(s).
Hosting\RuntimeErrors.cs Example of retrieving the detailsed information about the script runtime error(s).
Hosting\Older versions of CLR
Example of VS2008 project for the application osting the script engine built for .NET 3.5
Hosting\Referencing\Host.csExample demonstrating how to specify assembly referenced by the script from the host application (host application code)
Hosting\Referencing\Script.csExample demonstrating how to specify assembly referenced by the script from the host application (script code)
Hosting\Referencing\ExternalAsm.csExample demonstrating how to specify assembly referenced by the script from the host application (referenced assembly code)
Macros\script_simple.csExample of script using C++ style macro ("full property" macro)
Macros\script.csExample of script using C++ style macros ("full property", "New", "StringEnum" macros)
Macros\precompile.csExample of script using C++ style macros (macros definitions)
WWF\HelloWorld.cs       Example of a HelloWorld style WWF script application (application code)
WWFMsgBoxActivity.csExample of a HelloWorld style WWF script application (WWF Activity code)
Hosting\Classless.csScript hosting sample, which demonstrates invoking classless (method definition only) scripts.
Hosting\MethodSignatures.csScript hosting sample, which demonstrates different script invoking techniques.
Hosting\Performance.csScript sample, which demonstrates performance aspects of various script hosting scenarious.
Hosting\TypeSafety.csScript sample, which demonstrates type safety aspects of various script hosting scenarious.
Hosting\ConditionalCompilation.csDemonstrates how to implement conditional compilation using compiler symbols definitions
Hosting\CompilerErrors.cs Demonstrates how to access detailed information about compiling errors in a script
Sandboxing\Host.csExample of sandboxed script hosting.
Sandboxing\Danger.csScript which accesses the local file. This script is used in sandboxing sample Host.cs
Sandboxing\HostSimlified.cs Demonstrates the simplified syntax for executing code with specified permissions
PostSharp\Script.cs Demonstrates how to inject PostSharp aspects into scripts