我想在 Windows 檔案資源管理器中打開遠程 PC 的檔案夾:
此外,在其他方法中,我可以讀取檔案component.Path
夾中的檔案......
那么,為什么我無法將檔案夾打開到 Windows 檔案資源管理器中,我該怎么做才能使其正常作業?
謝謝您的幫助。
雷米
uj5u.com熱心網友回復:
我找到了一個解決方案:
private void openComponentFolder_Click(object sender, RoutedEventArgs e)
{
Component component = (sender as MenuItem).DataContext as Component;
ProcessStartInfo startInfo = new ProcessStartInfo()
{
WindowStyle = ProcessWindowStyle.Hidden,
FileName = "net",
Arguments = "use " Path.Combine(ConfigMorphee.Instance.PcPath, "c$") " /user:" BenchInfos.Current.UserName " " BenchInfos.Current.PcPassword
};
Process process = new Process() { StartInfo = startInfo };
process.Start();
process.WaitForExit();
if (component != null)
{
if (Directory.Exists(component.Path))
{
try
{
Process.Start(component.Path);
}
catch (Exception ex)
{
Logger.Error("Catch MainWindow - openComponentFolder_Click ", ex);
}
}
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/532981.html