Failed when open a MP4 file with IF statement

jackytank

New member
Joined
Apr 14, 2019
Messages
3
Programming Experience
Beginner
Hi everyone ! I'm a C# beginner and I've wrote my first code in Visual Studio Code ( C# extension included , .NET core SDK debugger )
my code is all about take the input of user then check it whether it's "secret" then it'll open a MP4 files , but something went wrong there I have no idea about , although I tried alot of solutions ...
C#:
using System;
using System.Diagnostics;

namespace Secret
{
    class Find
    {
        static void Main()
        {
            Console.WriteLine("Enter a secret code");
            string line = Console.ReadLine();
            if(line=="secret")
            {
                Process.Start(@"d:\\haha.mp4");
            }
            else
            {
                Console.WriteLine("You will never find my secret hahahahahahaahahahahahahahah");
                Console.ReadLine();
            }
        
        }

    }
}

after I typed "secret" it's appear a dialog :

526




what I done wrong guys ... ? tks for visit my thread
 
ProcessStartInfo.UseShellExecute Property (System.Diagnostics) | Microsoft Docs
Property Value said:
true if the shell should be used when starting the process; false if the process should be created directly from the executable file. The default is true on .NET Framework apps and false on .NET Core apps.
Remarks said:
When you use the operating system shell to start processes, you can start any document (which is any registered file type associated with an executable that has a default open action) and perform operations on the file, such as printing, by using the Process object. When UseShellExecute is false, you can start only executables by using the Process object.
 
Back
Top Bottom