2021-07-08

**

解决exe文件移植时所需dll文件整理打包的问题

**
Visual Studio2015(或其他版本或者编译IDE)生成的exe文件,移植时需要打包dll文件
方法如下:
下载Process Explore
Process Explore下载官网
我需要打包的exe文件
这里可以显示需要的所有dll文件
点击Ctrl+S 保存所有dll路径为txt文件这里插入图片描述
将txt路径下的dll文件全部复制到指定文件夹中去,这一步使用python代码实现

import os
import shutil
import sys


def copy_file(srcfile, dst_path):
    if not os.path.isfile(srcfile):
        print("%s not exist!" % srcfile)
    else:
        path, name = os.path.split(srcfile)
        if not os.path.exists(dst_path):
            os.makedirs(dst_path)
        shutil.copy(srcfile, dst_path + name)
        print("copy %s -> %s" % (srcfile, dst_path + name))


txt_path = 'txt文件路径,注意路径中的\改成/反斜杠'
dst_path = '输出到的目标路径,注意路径中的\改成/反斜杠'
if len(sys.argv) > 2:
    txt_path = sys.argv[1]
    dst_path = sys.argv[2]

with open(txt_path, 'r', encoding="utf-8") as f:
    for line in f.readlines():
        print(line)
        file = line.rstrip('\n')
        print(file)
        dst_dir = dst_path + '/'
        copy_file(file, dst_dir)

完成

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值