mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-22 09:19:18 +01:00
Made a wrapper script for launching process in explorer
This commit is contained in:
parent
a7a10367b7
commit
2db3f045d6
@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace DS4Windows
|
||||
{
|
||||
@ -146,9 +147,19 @@ namespace DS4Windows
|
||||
|
||||
public static void StartProcessInExplorer(string path)
|
||||
{
|
||||
string tmpPath = Path.Combine(Path.GetTempPath(), "urlopener.bat");
|
||||
// Create temporary bat script that Explorer will launch
|
||||
using (StreamWriter w = new StreamWriter(new FileStream(tmpPath, FileMode.Create, FileAccess.Write)))
|
||||
{
|
||||
w.WriteLine("@echo off"); // Turn off echo
|
||||
w.WriteLine($"@start \"\" /B /MIN \"{path}\""); // Launch URL
|
||||
w.WriteLine("@DEL \"%~f0\""); // Attempt to delete myself without opening a time paradox.
|
||||
w.Close();
|
||||
}
|
||||
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
startInfo.FileName = "explorer.exe";
|
||||
startInfo.Arguments = path;
|
||||
startInfo.Arguments = tmpPath;
|
||||
try
|
||||
{
|
||||
using (Process temp = Process.Start(startInfo)) { }
|
||||
|
Loading…
Reference in New Issue
Block a user