Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("PowerShdll.exe v0.1");
            string cmd = "";
            PS     ps  = new PS();

            while (true)
            {
                Console.Write("PS " + ps.exe("$(get-location).Path").Replace(System.Environment.NewLine, String.Empty) + ">");
                cmd = Console.ReadLine();
                Console.WriteLine(ps.exe(cmd));
            }
        }
Пример #2
0
        public static void getPSTerm()
        {
            AllocConsole();
            IntPtr         stdHandle      = GetStdHandle(STD_OUTPUT_HANDLE);
            SafeFileHandle safeFileHandle = new SafeFileHandle(stdHandle, true);
            FileStream     fileStream     = new FileStream(safeFileHandle, FileAccess.Write);
            Encoding       encoding       = System.Text.Encoding.GetEncoding(MY_CODE_PAGE);
            StreamWriter   standardOutput = new StreamWriter(fileStream, encoding);

            standardOutput.AutoFlush = true;
            Console.SetOut(standardOutput);
            Console.WriteLine("PowerShdll.dll v0.1");
            string cmd = "";
            PS     ps  = new PS();

            while (true)
            {
                Console.Write("PS " + ps.exe("$(get-location).Path").Replace(System.Environment.NewLine, String.Empty) + ">");
                cmd = Console.ReadLine();
                Console.WriteLine(ps.exe(cmd));
            }

            //MessageBox.Show("Now I'm happy!");
        }
Пример #3
0
 public PowerShdll()
 {
     ps = new PS();
 }