【问题标题】:How do i get Location String as path using c#?如何使用 c# 获取位置字符串作为路径?
【发布时间】:2020-12-28 09:33:10
【问题描述】:

enter image description here

https://i.stack.imgur.com/6KXds.png

我想在 Explorer.exe 中打开 Location String

try
{
    using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wilcom\Wilcom EmbroideryStudio\4.2H"))
    {
        if (key != null)
        {
            Object o = key.GetValue("Location");
            if (o != null)
            {
                Version version = new Version(o as String);  //"as" because it's REG_SZ...otherwise ToString() might be safe(r)
                Process.Start(key.GetValue("Location").ToString());
            }
        }
    }
}
catch (Exception ex)  //just for demonstration...it's always best to handle specific exceptions
{
    //react appropriately
}

它不工作。请帮忙。

【问题讨论】:

    标签: c# process location registry key-value


    【解决方案1】:

    Process.Start("explorer.exe", "/select," + o.ToString());

    这将打开文件资源管理器,并使用命令行参数指定的位置设置。

    Explorer.exe - Windows CMD - SS64.com

    【讨论】:

    • 请解释为什么这是一个解决方案以及您的代码。
    • OP 并没有做太多努力来查找 explorer.exe 的命令行,我认为我的意思很明显。已编辑。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 2013-07-07
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多