我正在尝试制作一个卸载工具,但我遇到了代码末尾的问题
此操作有效,但仅删除.exe,而不删除cwd
subprocess.Popen(f"WAITFOR /T 2 PAUSE 2>NUL & DEL \"{argv[0]}\" /f", shell=True, creationflags=0x00000008)这会删除目录中的所有内容,但不会删除目录本身
subprocess.Popen(f"WAITFOR /T 2 PAUSE 2>NUL & RD /Q /S \"{os.getcwd()}\"", shell=True, creationflags=0x00000008)发布于 2021-08-15 16:32:30
这是可行的:
os.chdir("..")
subprocess.Popen(f"(WAITFOR /T 5 PAUSE 2>NUL) & (RD /Q /S \"{os.getcwd()}\\FolderToDelete\")", shell=True, creationflags=0x00000008)https://stackoverflow.com/questions/68789399
复制相似问题