#
import sys,re
if __name__=="__main__":
rc = sys.argv[1]
ver = sys.argv[2]
ver = ver.replace('.', ',')
ver1 = ver.replace(',' , ', ')
rc = rc.replace("\\\\","\\")
f = open(rc,'r')
lines = f.readlines()
olines = []
for l in lines:
if l.startswith(' FILEVERSION '):
l = ' FILEVERSION ' + ver + '\n'
elif l.startswith(' PRODUCTVERSION '):
l = ' PRODUCTVERSION ' + ver + '\n'
else:
l = re.sub( r'(\s+VALUE\s"FileVersion",\s+)"(.*)"',r'\1"%s"' % ver1 , l )
l = re.sub( r'(\s+VALUE\s"ProductVersion",\s+)"(.*)"',r'\1"%s"' % ver1 , l )
olines.append(l)
f.close()
f = open(rc,'w')
f.writelines(olines)
f.close()
python 修改rc文件版本号的脚本
最新推荐文章于 2019-07-25 09:59:27 发布