以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]怎样自动连接共享文件夹  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=80819)

--  作者:wldhj
--  发布时间:2016/2/2 17:39:00
--  [求助]怎样自动连接共享文件夹
照片上传到局域网共享文件里,每次都要手动输入服务器用户名、密码连接一次共享文件夹,能不能在程序里设置自动连接呢?
--  作者:狐狸爸爸
--  发布时间:2016/2/2 18:19:00
--  
Dim p As new Process()
p.StartInfo.FileName = "cmd.exe"
p.StartInfo.UseShellExecute = False \'关闭Shell的使用
p.StartInfo.RedirectStandardInput = True \'重定向标准输入
p.StartInfo.RedirectStandardOutput = True \'重定向标准输出
p.StartInfo.RedirectStandardError = True \'重定向错误输出
p.StartInfo.CreateNoWindow = True \'设置不显示窗口
p.Start()
p.StandardInput.WriteLine("net use \\\\192.168.1.211\\共享的文件夹名  密码 /user:用户名")
p.StandardInput.WriteLine("exit")
\'Dim strRst As String = p.StandardOutput.ReadToEnd()