python 不执行命令_python 3.4操作系统不执行命令

我有一些代码使用python创建一个锁屏,删除任务栏并阻止它们离开。但是,当他们得到正确的密码,它不会使任务栏回来。命令在cmd中工作,但在python中不工作。在

代码如下:import os

from tkinter import*

import time

run = input("Do you want to lock your computer? ")

if run == "yes":

a=Tk()

a.overridedirect(1)

w, h = a.winfo_screenwidth(), a.winfo_screenheight()

a.geometry("%dx%d+0+0" % (w, h))

os.system('taskkill /f /im explorer.exe')

a.attributes("-topmost", True)

L1 = Label(a, text="Please enter the password to continue: ")

L1.pack( side =TOP)

Ebox = Entry(a, bd =5)

Ebox.pack(side =TOP)

Ebox.config(show="*");

def check():

if Ebox.get() == "password":

time.sleep(0.3)

os.system('powershell -command "Invoke-item c:\windows/explorer.exe"') # This line does not execute the command

a.destroy()

b = Button(a, text="submit", command=check )

b.pack(side=TOP)

a.mainloop()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值