using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FileInfo { class Program { [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type); static void Main(string[] args) { //Shell32.Shell shell = new Shell32.Shell(); //Shell32.Folder objFolder; //Shell32.FolderItem fi; //objFolder = shell.NameSpace(@"C:\varfiles\temp\"); //String[] arguments = Environment.GetCommandLineArgs(); //Console.WriteLine("GetCommandLineArgs: {0}", arguments); System.IO.FileInfo fi = new System.IO.FileInfo(@"C:\varfiles\temp\Påskris.jpg"); Console.WriteLine("{0}", fi.Name); // Read text file as one string. string text = System.IO.File.ReadAllText(@"C:\varfiles\temp\greeting.txt"); // Display the file contents to the console. Variable text is a string. Console.WriteLine("Contents of WriteText.txt = {0}", text); } } } ##### using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Runtime.InteropServices; namespace FileInfo2 { class Program { // Main Method which accepts the // command line arguments as // string type parameters [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int MessageBox(IntPtr hWnd, String text, String caption, uint type); static void Main(string[] args) { //String[] arguments = Environment.GetCommandLineArgs(); //Console.WriteLine("GetCommandLineArgs: {0}", arguments); // To check the length of // Command line arguments if (args.Length > 0) { Console.WriteLine("Arguments Passed by the Programmer:"); // To print the command line // arguments using foreach loop foreach (Object obj in args) { Console.WriteLine(obj); } } else { Console.WriteLine("No arguments found."); } } } }