Untitled
unknown
csharp
2 years ago
931 B
6
Indexable
using System;
using System.IO;
using System.Reflection;
using System.Management.Automation;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
// Get the current assembly
Assembly assembly = Assembly.GetExecutingAssembly();
// Get the clean.ps1 script as an embedded resource
Stream stream = assembly.GetManifestResourceStream("cleanscript.clean.ps1");
// Read the contents of the script
string script;
using (StreamReader reader = new StreamReader(stream))
{
script = reader.ReadToEnd();
}
// Create a PowerShell instance and run the script
using (PowerShell ps = PowerShell.Create())
{
ps.AddScript(script);
ps.Invoke();
}
}
}
}
cEditor is loading...