Created
April 16, 2025 10:32
-
-
Save zett42/fa8aa34e8aed20bdd0a3bd17d516ea95 to your computer and use it in GitHub Desktop.
Simple PowerShell script to build a C# console application that prints all arguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Builds a C# console application that prints all arguments (requires Windows PowerShell 5.1) | |
| Add-Type -OutputType ConsoleApplication -OutputAssembly ShowArgs.exe -TypeDefinition @' | |
| using System; | |
| namespace MyApp | |
| { | |
| class Program | |
| { | |
| static int Main( string[] args ) | |
| { | |
| for( int i = 0; i < args.Length; i++ ) | |
| { | |
| Console.WriteLine( String.Format( "Arg {0}: {1}", i + 1, args[ i ] ) ); | |
| } | |
| return 0; | |
| } | |
| } | |
| } | |
| '@ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment