小编ken*_*dos的帖子

"这个应用程序无法启动." 仅当文件位于system32目录中时

我写了一小段从互联网上下载文件的软件,也就是说,仅此而已.我的意图是通过命令行使用它...它工作得很好,但是当我把它放在C:\ Windows\System32 \实际上从我想要的任何地方使用它现在不起作用...它没有'抛出异常...它只是向我显示这个消息框 - http://i.imgur.com/a7rlMgo.png如果我点击"是"它会在浏览器中打开此页面 - http://support.microsoft. COM/KB/2715633/EN-US

我该怎么办才能让它发挥作用?

代码,如果有任何用途..:

private const string InsufficientParametersMessage = "Insufficient Parameters...";

private static string[] _arguments;

static void Main(string[] args)
{
    _arguments = args;

    TakeCommand();

    Environment.Exit(0);
}

private static void TakeCommand()
{
    if (_arguments.Length < 1)
    {
        Console.WriteLine(InsufficientParametersMessage);
    }
    else if (_arguments.Length == 1)
    {
        DownloadFile(_arguments[0]);
    }
    else if (_arguments.Length > 1)
    {
        DownloadFile(_arguments[0], _arguments[1]);
    }
}

private static void DownloadFile(string url)
{
    DownloadFile(url, Path.GetFileName(url));
}

private static void DownloadFile(string url, string localFileName)
{ …
Run Code Online (Sandbox Code Playgroud)

c# system32

13
推荐指数
1
解决办法
1万
查看次数

标签 统计

c# ×1

system32 ×1