共享文件夹进程的网络使用突然在 C# 中不起作用

问题描述

我认为我的问题很简单,但经过几天的研究和测试,找不到解决方案。

我有以下方法从IP连接到特定的共享文件夹,然后在“资源管理器”下打开文件

为此,我使用了 Net use 命令。最初它运行完美!

但是在向我的应用程序添加更多命令之后。净使用不起作用。我试着从0开始创建,还是一样。

如果我创建一个新的并且只添加很少的功能,该方法可以完美运行,但是如果我超过了功能的“限制”,则该方法不起作用。

我完全不明白为什么并且不明白相同的代码一开始在应用程序中有效,如果我添加更多东西就不起作用。

我尝试等待任务,不同的线程,在其他方法中创建它...相同的结果。

    private static void LaunchFiles(string computer1,string Route1,string serial1,string program1)
    {
            ipcalc calcula = new ipcalc(); //Customed class that calculates the IP
      
            int numero1IP = calcula.ipnum1(int.Parse(serial1)); //Calculates the second number and third number of the IP
            double numero2IP = calcula.ipnum2(double.Parse(serial1));


//First I launch net use
            System.Diagnostics.processstartinfo procStartInfo = new 
            System.Diagnostics.processstartinfo("net.exe",@"use \\10." + numero1IP + "." + numero2IP + "." + computer1 + @"\c password /USER:user");
            procStartInfo.UseShellExecute = false;
            procStartInfo.CreateNowindow = true;
            System.Diagnostics.Process processtemp = new System.Diagnostics.Process();
            processtemp.StartInfo = procStartInfo;
            processtemp.Start();

//Second I open the folder with explorer.
            Thread.Sleep(1000); //I tried different values here,same result
            System.Diagnostics.Process.Start(program1,@" \\10." + numero1IP + "." + numero2IP + "." + computer1 + Route1);

提前致谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)