相关问题:
Trying to extract version info and save to INI file on Windows 11 with PowerShell
被接受的答案是这样的:
$exe_info = Get-Item -Path '.\MeetSchedAssistSetup.exe'
$ini_path = '.\version_meetschedassist2.ini'
$ini = Get-IniContent -FilePath $ini_path
$ini['MeetSchedAssist Update']['LatestVersion'] =
'{0}.{1}{2}' -f $exe_info.VersionInfo.FileMajorPart,
$exe_info.VersionInfo.FileMinorPart, $exe_info.VersionInfo.FileBuildPart
$ini['MeetSchedAssist Update']['LatestVersionString'] =
'{0}.{1}.{2}' -f $exe_info.VersionInfo.FileMajorPart,
$exe_info.VersionInfo.FileMinorPart, $exe_info.VersionInfo.FileBuildPart
Out-IniFile -FilePath $ini_path -InputObject $ini -Force
我现在想知道,如果我可以做的事情更容易与Inno安装?毕竟,我更新这个INI每当我建立一个新版本的安装程序。我知道我们已经访问了版本信息之前,并使用PowerShell:
#define AppVerText() \
GetVersionComponents(SourceDir + '\Meeting Schedule Assistant.exe', \
Local[0], Local[1], Local[2], Local[3]), \
Str(Local[0]) + "." + Str(Local[1]) + "." + Str(Local[2])
#define GetSHA256OfFile(FileName) \
Local[0] = AddBackslash(GetEnv("TEMP")) + "sha256.txt", \
Local[1] = \
"-ExecutionPolicy Unrestricted -Command """ + \
"Set-Content -Path '" + Local[0] + "' -NoNewline -Value " + \
"(Get-FileHash('" + FileName + "')).Hash" + \
"""", \
Exec("powershell.exe", Local[1], SourcePath, , SW_HIDE), \
Local[2] = FileOpen(Local[0]), \
Local[3] = FileRead(Local[2]), \
FileClose(Local[2]), \
DeleteFileNow(Local[0]), \
LowerCase(Local[3])
有没有可能做同样的事情,因为我的原始脚本?采取版本信息从exe(Meeting Schedule Assistant.exe
)和更新INI文件,这是在同一个文件夹作为安装文件?这将是有意义的更新,从这里在Inno安装。
1条答案
按热度按时间u59ebvdq1#
使用
WriteIni
preprocessor function。类似于以下内容(未测试):(and对另一个键重复)