I want to used as a shortcut button, click the button to achieve a Shared folder to open the local area network (LAN) a computer, but has set up a login name and password, now want to say how to do ability to automatically enter the account name and password, open the folder,
Below is my online code but click login to check over time, the computer or the jump out to enter the account name and password, please help see oh
Sub Loading () Net Shell "CMD/c use \ \ 192.168.222.18" & amp; CRH (34) & amp; "123" & amp; CRH (34) & amp; "/user:" & amp; CRH (34) & amp; "Administrator" & amp; CRH (34), vbHide Shell start \ \ "CMD/c 192.168.222.18 \ Shared disk", vbHide End Sub CodePudding user response:
This web site and people
CodePudding user response:
Fyi:
ServerShare="\ \ 192.168.3.56 \ d $" The UserName="somedomain \ someuser" Password="somepassword" The Set NetworkObject=CreateObject (" work "WScript.Net NetworkObject. MapNetworkDrive ", "ServerShare, False, UserName, Password," The Set of FSO=CreateObject (" Scripting. FileSystemObject ") Set the Directory=FSO. GetFolder (ServerShare) For Each FileName In the Directory. The Files WScript. Echo FileName. The Name Next Set the FileName=Nothing Set the Directory=Nothing The Set of FSO=Nothing NetworkObject. RemoveNetworkDrive ServerShare, True, False The Set NetworkObject=Nothing CodePudding user response:
C: \ & gt;
net use/? This command syntax is:
NET USE
[devicename | *] [\ \ computername \ sharename [\ volume] [password | *]]
Username] [/USER: [domainname \]
[/USER: [dotted domain name \] username]
[/USER: [username @ dotted domain name]
[/SMARTCARD]
[/SAVECRED]
[[/DELETE] | [/PERSISTENT: {YES | NO}]]
NET USE {devicename | *} [password | *]/HOME
NET USE//PERSISTENT: {YES | NO}
C: \ & gt;
CodePudding user response:
refer to the second floor zhao4zhong1 response: are for reference only: ServerShare=\ \ "192.168.3.56 \ d $" The UserName="somedomain \ someuser" Password="somepassword" The Set NetworkObject=CreateObject (" work "WScript.Net NetworkObject. MapNetworkDrive ", "ServerShare, False, UserName, Password," The Set of FSO=CreateObject (" Scripting. FileSystemObject ") Set the Directory=FSO. GetFolder (ServerShare) For Each FileName In the Directory. The Files WScript. Echo FileName. The Name Next Set the FileName=Nothing Set the Directory=Nothing The Set of FSO=Nothing NetworkObject. RemoveNetworkDrive ServerShare, True, False The Set NetworkObject=Nothing Thank you very much for your answer: oh, there's a problem with is the d \ \ 192.168.3.56 \ d $$what is the meaning of oh, if not this will have any impact, I Shared folder path is \ \ 192.168.222.18 \ Shared files, the UserName is administrator, you have a \ the account name, so didn't understand well, CodePudding user response:
ServerShare=\ \ "192.168.222.18 \ business promotion department Shared disk $" The UserName="administrator" Password="Ting1123" The Set NetworkObject=CreateObject (" work "WScript.Net NetworkObject. MapNetworkDrive ", "ServerShare, False, UserName, Password," The Set of FSO=CreateObject (" Scripting. FileSystemObject ") Set the Directory=FSO. GetFolder (ServerShare) For Each FileName In the Directory. The Files WScript. Echo FileName. The Name Next Set the FileName=Nothing Set the Directory=Nothing The Set of FSO=Nothing NetworkObject. RemoveNetworkDrive ServerShare, True, False The Set NetworkObject=Nothing After I changed the tip path is wrong CodePudding user response:
ServerShare=\ \ "192.168.222.18 \ business promotion department Shared disk" The UserName="domain \ administrator" Password="Ting1123" '" business promotion department Shared disk "is" \ \ 192.168.222.18 "the share name 'domain is the domain administrator (can pass on the "\ \ 192.168.222.18" CMD window to perform the whoami command to see) CodePudding user response:
refer to 6th floor zhao4zhong1 response: ServerShare="\ \ 192.168.222.18 \ business promotion department Shared disk" The UserName="domain \ administrator" Password="Ting1123" '" business promotion department Shared disk "is" \ \ 192.168.222.18 "the share name 'domain is the domain administrator (can pass on the "\ \ 192.168.222.18" CMD window to perform the whoami command to view) changed after prompt does not allow a user to use more than one user name multiple connection with the server or Shared resource, CodePudding user response:
refer to 7th floor u011925054 response: Quote: refer to the sixth floor zhao4zhong1 response: ServerShare=\ \ "192.168.222.18 \ business promotion department Shared disk" The UserName="domain \ administrator" Password="Ting1123" '" business promotion department Shared disk "is" \ \ 192.168.222.18 "the share name 'domain is the domain administrator (can pass on the "\ \ 192.168.222.18" CMD window to perform the whoami command to view) changed after prompt does not allow a user to use more than one user name multiple connection with the server or Shared resource, I want to open the folder directly oh, like jump out the window, click on my computer access is not the background CodePudding user response:
reference 3 floor CodePudding user response:
references 9 f zhao4zhong1 response: