C# Examples

This page lists some console utilities (and one GUI based utility) I wrote in C#.

To allow using them in batch files, most utilities return their results as errorlevels.
Check the source code and the command line help text to translate the return codes/errorlevels back to results.

Some of these utilities were tested in Windows XP, all of them in Windows 7.
They were compiled with Visual Studio 10 Express Edition, with the target framework set to .NET Framework 4 Client Profile.

Download the ZIPed sources Click the floppy disk icons to download the ZIPed sources.
Checksums for the ZIPed sources Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPed sources.
  Click the program name to view its source code.

 

C# Examples
Click the floppy disk icons to dowload the ZIPed sources Click the question mark icons to view the MD5 and SHA1 checksums for the ZIPed sources Name Version Description Last modified Remarks
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Asc 1.00 Return the decimal character code for the specified ASCII character 2012-05-11  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ASCII 1.00 Convert text from a file or standard input into ASCII and send it to standard output 2014-01-30 As there are many "standards" to choose from when encoding text to Unicode, this tool may sometimes fail and return garbled text. In that case, try Unicode2ASCII instead.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source BatHL 0.51 Batch HighLighter: search batch source code for unterminated quotes, parenthesis and variables, and a number of other common coding errors 2014-02-07 Still in beta!
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source CameraModel 2.00 Return the camera model for the specified image file 2012-10-16 This utility searches only the first kilobyte of the specified image file, which makes it a lot faster than FINDSTR or STRINGS.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source CanonModel 1.00 Return the Canon camera model for the specified image file 2012-10-07 This utility searches only the first kilobyte of the specified image file, which makes it a lot faster than FINDSTR or STRINGS.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source CapsLock 1.01 Read or set CapsLock key state 2012-06-28  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source CaptureDate 1.00 Return the capture date and time for the specified image file 2013-02-13 This utility searches only the first kilobyte of the specified image file, which makes it a lot faster than FINDSTR or STRINGS.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Chr 1.00 Return the ASCII character for the specified decimal character code 2012-05-10  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ClCalc 1.01 Command Line Calculator 2014-03-25 Based on code by "markman", found in a discussion section of CodeProject.com.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source CloneDate 0.50 BETA Modify the LastModified date (timestamp) of the target file(s) to match the specified source file's timestamp 2012-07-19  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source DateTimeBox 1.00 Batch tool to present a Date/Time Picker dialog and return the selected date and/or time in the specified format 2014-09-07 Inspired by code from Gorkem Gencay on StackOverflow.com.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Drives 2.00 List available and/or used drive letters 2012-06-25 Based on code found at DreamInCode.com.
Unlike ListDrives.exe, Drives.exe does not require elevated or administrative permissions.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source FastPing 1.00 Faster PING alternative 2012-09-25  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source GetMyPID 1.00 Return the parent process' PID. 2011-05-16 Requires ParentProcess.cs by Jared Barneck
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source GetTitle 4.00 Read the current Window's title, optionally removing the "Administrator:" prefix if running with elevated privileges (Vista and later), and optionally removing the appended command line. 2011-05-10 As of version 4.00, GetTitle works in "all" Windows versions, rendering GetTitleXP, the separate XP version, obsolete.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source HideInput 1.00 Read 1 line of keyboard input while hiding what's being typed, by temporarily setting the console foreground color equal to its background color. 2012-09-29  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source InputBox 1.11 Batch tool to prompt for input (GUI) 2014-09-12 Most of the code comes from Gorkem Gencay on StackOverflow.com.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source is6432os 1.00 Return "errorlevel" 64 if current OS is 64-bit, or 32 if it is 32-bit 2010-07-04  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source isDST 1.01 Return "errorlevel" 0 if a date is in Daylight Saving Time, or 2 if it isn't 2012-06-28  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source IsElevated 1.00 Return "errorlevel" 0 if current process has elevated privileges, or 1 if not 2011-01-03  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source IsFAT 1.00 Return "errorlevel" 0 if the specified drive is FAT formated, 2 if not, or 1 if not ready 2011-04-22  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source IsNTFS 1.00 Return "errorlevel" 0 if the specified drive is NTFS formated, 2 if not, or 1 if not ready 2011-04-22  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source IsRedirected 1.01 Return a number containing the redirection status of StdIn (+2), StdOut (+4) and StdErr (+8) 2012-06-19  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ListDrives 1.10 Return a string containing all drive letters in use 2011-04-06 Unlike Drives.exe, ListDrives.exe requires elevated or administrative permissions.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ListNICs 1.00 List physical network adapters 2011-11-01  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ListPrinters 1.10 List all available local printers 2011-04-06  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source LoCase 1.02 Convert filenames to all lowercase 2012-07-23  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source MessageBox 1.10 Show a message in a MessageBox and return the button clicked 2014-08-21  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source NewTempFile 1.00 Create a zero-byte temporary file and display its name on screen 2012-07-02  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source NumLock 1.01 Read or set NumLock key state 2012-06-28  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ODT2PDF 1.00 Save LibreOffice/OpenOffice Writer files as PDF 2014-01-28 Requires LibreOffice/OpenOffice, its SDK and a 32-bit Java runtime.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source OpenFileBox 1.01 Batch tool to present an Open File dialog and return the selected file path 2014-08-28  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source OpenFolderBox 1.01 Batch tool to present a Browse Folders Dialog and return the selected path 2014-09-16  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Paste 2.00 Read text from clipboard and write to file or screen 2014-08-20  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source PDFPageCount 1.02 Return the page count for the specified PDF file(s) 2011-10-13 Based on sample code by Dharmaraj Nagarajan
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source PingSite 1.21 Check if a website is up and running 2011-10-18  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source PrintAny 3.01 Print files using the print command or verb registered for the file type 2012-11-13 Not all file types have registered Print(To) commands or verbs
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source PrinterSelectBox 2.00 Batch tool to present a Select Printer dialog and return the selected printer 2014-09-03 Inspired by code from Gorkem Gencay on StackOverflow.com.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Printing 2.31 Pause or resume printing, or flush all queued printjobs on the specified printer(s), or list all printers, their status and number of printjobs 2012-12-21 Requires PrinterInfo.cs by Bas van der Woude
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source PrintScreen 1.00 Save a screenshot as image or save the current console buffer as text 2012-10-02 Credits: Code to read console buffer by Simon Mourier; code for graphic screenshot by Ali Hamdar
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ReadLine 0.30 beta Read the specified line(s) from a text file or from standard input 2012-05-19  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source RxGrep 2.00 Multi-line FindStr/Grep like tool 2012-12-11 See the FINDSTR page for a usage sample
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source SaveFileBox 1.00 Batch tool to present a Save File dialog and return the selected file path 2014-08-28  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source ScrollLock 1.01 Read or set ScrollLock key state 2012-06-28  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source SplitTextFile 0.50 beta Split a large file into smaller chunks 2013-11-08  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source StringHash 1.01 Return the MD5 or SHA* hash value for the specified string 2010-07-29  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Tail 1.01 Return the specified number of lines from the end of the specified file 2013-11-19 Code to detect redirection by Hans Passant on StackOverflow.com.
Code to detect file encoding by Jason Pierce on StackOverflow.com.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Tee 1.02 Redirect Standard Input to Standard Output and to a file 2012-07-11 Code to detect redirection by Hans Passant on StackOverflow.com.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source TranslateCulture 1.00 List translations for weekdays and/or month names for the specified cultures (languages) 2011-05-18  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Unicode2ASCII 1.00 Convert text from a file or standard input into ASCII and send it to standard output 2014-01-30 As there are many "standards" to choose from when encoding text to Unicode, this tool may sometimes fail and return garbled text. In that case, try ASCII instead.
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source UpCase 1.02 Convert filenames to all uppercase 2012-07-23  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source WaitASecond 1.00 A 900..1100 milliseconds random time delay 2011-05-11  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source WANIP 1.02 Get the computer's WAN IP address 2011-06-27  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source WGetLite 1.00 Get web content (text only) 2011-04-14  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Which 1.30 Port of the UNIX command to Windows 2012-06-11  
Click the floppy disk icon to dowload the ZIPed source Click the question mark icon to view the MD5 and SHA1 checksums for the ZIPed source Wireless 1.00 Monitor an 802.11 wireless connection 2012-07-06 This is a GUI based program, not a command line utility.
Works in XP only.

 


page last uploaded: 18 November 2012, 19:57