pyqt在windows下的cmd相关

2021-07-11 02:06

阅读:520

标签:test   kernel   star   read   signal   tmp   console   strip   out   

1. cmd调用

(1)

shell_cmd = ‘...‘
cmd = shlex.split(shell_cmd)
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while p.poll() is None:
line = p.stdout.readline()
line = line.strip()
if line:
s1 = str(line, encoding=‘utf-8‘) # encoding=‘gb2312‘
resture
+= s1

(2)模拟双击
CREATE_NO_WINDOW = 0x08000000
os.startfile("。。。.exe")

time.sleep(2)

subprocess.call(‘taskkill /F /IM 。。。.exe‘, creationflags=CREATE_NO_WINDOW)


 

 

2.打包后的cmd隐藏

几种方法组合食用效果更佳:

(1)

  import ctypes
    whnd = ctypes.windll.kernel32.GetConsoleWindow()
  if whnd != 0:
  ctypes.windll.user32.ShowWindow(whnd, 0)
  ctypes.windll.kernel32.CloseHandle(whnd)()

(2)

shell_cmd = ‘...‘
cmd = shlex.split(shell_cmd)
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while p.poll() is None:
line = p.stdout.readline()
line = line.strip()
if line:
s1 = str(line, encoding=‘utf-8‘) # encoding=‘gb2312‘
resture += s1

(3)
CREATE_NO_WINDOW = 0x08000000
subprocess.call(‘taskkill /F /IM test8_btc.exe‘, creationflags=CREATE_NO_WINDOW)
 

 (4) spec文件

exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name=‘test_addr‘,
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=False ) # console置为False

pyqt在windows下的cmd相关

标签:test   kernel   star   read   signal   tmp   console   strip   out   

原文地址:https://www.cnblogs.com/moon-fire/p/9660748.html


评论


亲,登录后才可以留言!