使用with创建power shell对象,调run方法即可。 importosfromglobimportglobimportsubprocessasspclassPowerShell:# from scapydef__init__(self,coding,):cmd=[self._where('PowerShell.exe'),"-NoLogo","-NonInteractive",# Do not print headers"-Command","-"]# Listen commands from stdinstartupinfo=sp.STA...
你可以通过调用一个函数来执行一行powershell。https://github.com/Dustin-dusTir/interactive-powershell-...
returncode == 0: # 命令执行成功 print("命令执行成功:", output.decode('utf-8')) else: # 命令执行失败 print("命令执行失败:", error.decode('utf-8')) except Exception as e: print("执行命令时发生异常:", str(e)) # 调用函数执行adb命令 execute_adb_command("adb devices") 上述代码中,...
你可以通过调用一个函数来执行一行powershell。https://github.com/Dustin-dusTir/interactive-powershell-...