我正在尝试使用以下代码显示文件夹中的文件:
import subprocess
import os
subprocess.call(r'net use \\192.168.50.11c$Folder_Name /user:vicky password:pass123', shell=True) #connect with network drive
print('Connection Established')
x = os.listdir('\\192.168.50.11\c$\Folder_Name') #display the name of the files in directory
print(x)
但得到错误为:
WinError 1326 the Username or password is incorrect:\\192.168.50.11\c$\Folder_Name
我该如何解决这个问题?
您必须执行如下命令:
subprocess.call(r'net use \\192.168.50.11c$Folder_Name /user:vicky pass123', shell=True) #connect with network drive
x = os.listdir('\\192.168.50.11\c$\Folder_Name') #display the name of the files in directory
print(x)
你必须去掉">密码";从命令