import os
import shutil
def listdirectory():
global computername
computername = input("What is the computer name? ")
completepathlist = fr"\\{computername}\C$\Users"
return os.listdir(completepathlist)
def username():
global completepath
global usernameinput
usernameinput = input("What is the user name? ")
completepath = fr"\\{computername}\C$\Users\{username}\AppData\Local\Google"
def programrunningcheck():
password = input("What is your password? ")
command = "taskkill /s " + str(computername) + " /u " + str(usernameinput) + " /p " +password+ " /im chrome.exe"
print(command)
os.system(command)
def deletegoogleapp():
shutil.rmtree(completepath)
#Functions being called
print(listdirectory())
username()
programrunningcheck()
deletegoogleapp()
在调用deletegoogleapp
函数并接收
\\DESKTOP-62A8SSM\C$\Users\"function username at 0x010C8B28\AppData\Local\Google
看起来没有将变量completepath
从另一个函数传递到googleapp
函数。你知道吗
更改您的函数用户名:
修复了var的原始问题,并进行了一些其他编码更改
您需要存储
username
的返回值,现在,您没有向deletegoogleapp
传递任何内容。所以你可以:如果返回的路径
u
是有效的,则应该可以这样做。你知道吗相关问题 更多 >
编程相关推荐