{
// Instantiate the secure string.
System.Security.SecureString securePwd = new System.Security.SecureString();
ConsoleKeyInfo key;
Console.Write("Enter password: ");
do
{
key = Console.ReadKey(true);
// Ignore any key out of range.
if (((int)key.Key) >= 32 && ((int)key.Key <= 190))
{
// Append the character to the password.
securePwd.AppendChar(key.KeyChar);
Console.Write("*");
}
// Exit if Enter key is pressed.
}
while (key.Key != ConsoleKey.Enter);
Console.WriteLine();
try
{
System.Diagnostics.Process.Start("Notepad.exe", "ryanes", securePwd, "lanet");
}
catch (Win32Exception ex)
{
Console.WriteLine(ex.Message);
}
}