我正在使用以下代码在10.42.X.X位置打开并保存文件。如何编写代码以提供用户名和密码来访问此IP机器?
private void TreeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
textBox1.Text = (treeView1.SelectedNode?.Tag as Country)?.Description ?? string.Empty;
}
答案 0 :(得分:1)
首先映射位置/驱动器,然后传递用户名和密码变量,如此
Dim objNetwork as Object, persistent as Boolean
persistent = false
set objNetwork = WScript.CreateObject("WScript.Network")
objNetwork.MapNetworkDrive "drivelettergoeshere:", ""\\10.42.x.x\............", persistent, "username", "password"