-1

そこで、コマンド引数を使用してアプリケーションを実行するための URL プロトコルを作成しました。

これが私のコードです:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;

namespace iw4Protocol
{
    class Program
    {
        static void Main(string[] args)
        {
            RegistryKey key = Registry.ClassesRoot.OpenSubKey("gameProtocol");

            if (key == null)
            {
                string iw4FullPath = Directory.GetCurrentDirectory();

                gameProtocol protocol = new gameProtocol();
                protocol.RegisterProtocol(gameFullPath);
            }
            else
            {
                RegistryKey gamepathkey = Registry.ClassesRoot.OpenSubKey("gameProtocol");
                string gamepath = gamepathkey.GetValue("gamepath").ToString();

                Environment.SetEnvironmentVariable("path",gamepath);



                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.FileName = @"test.exe";
                startInfo.Arguments = Environment.CommandLine;
                Process.Start(startInfo);
            }
        }
    }
}

問題は、プログラムを起動するためにいくつかのファイルが必要ですが、パスが「設定」されていないためにそれらをロードできないことです。

このパスを設定して、必要なすべてのファイル (/cdコマンドなど) を起動するにはどうすればよいですか?

4

1 に答える 1