执行/运行以下Inno代码,我收到错误消息。文件“ c:\ xxxx-runtime \ unins000.exe”确实存在。
错误消息:
Unable to execute file:
"c:\xxxx-runtime\unins000.exe"
CreateProcess failed; code 267.
The directory name is invalid.
下面显示的Inno代码:
[UninstallRun]
Filename: "{code:ARGetUninstallString}";
;Filename: {code:ARGetUninstallString}; -- same result
[Code]
function ARGetUninstallString(p: String): String;
var
sUnInstPath: String;
sUnInstallString: String;
begin
sUnInstPath := ExpandConstant('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\xxxx_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKEY_CURRENT_USER, sUnInstPath, 'UninstallString', sUnInstallString);
Result := sUnInstallString;
end;
但是,如果我更换
,它会很好地工作[UninstallRun]
Filename: "{code:ARGetUninstallString}";
使用
[UninstallRun]
Filename: "c:\xxxx-runtime\unins000.exe";
是否有Inno专家知道问题所在?
答案 0 :(得分:0)
您发现自己[Code]
常数是在安装时评估的。
因此,请完全在[UninstallRun]
部分中实现代码,而不要使用[Code]
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall { or usUninstall } then
begin
{ Use RegQueryStringValue and Exec here }
end;
end;
部分。
UninstallString
尽管您需要修复可解析卸载程序命令行的代码。注意在有关该主题的所有现有问题中,import os
import glob
import pandas as pd
import numpy as np
files = glob.glob('folder/*.csv')
for file in files:
file_name = os.path.splitext(os.path.basename(file)) # Get the file name without extension
df = pd.read_csv(file)
#make conversion
df['Time taken'] = pd.to_datetime(df['Time taken'])
df['Time taken'] = df['Time taken'].dt.hour + df['Time
taken'].dt.minute / 60
#output file
df.to_csv('{}_conv.csv'.format(file_name, index = False)
是如何拆分为程序路径和参数的。由于程序路径用双引号引起来,因此需要将其删除。
答案 1 :(得分:0)
以下是我的解决方案,在从reg获取路径之前,基本上在[code]部分中执行xxxxx-runtime.exe。以下是源代码:
[Files]
Source: ".\xxxxx-runtime.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
[UninstallRun]
Filename: {code:GetUninstallString}; BeforeInstall: SetUninstallString; RunOnceId: {code:GetUninstallString}
[Code]
var
uninstallString: String;
function getUninstallString(p: String): String;
begin
Result := uninstallString;
end;
// execute xxxxx-runtime.exe
procedure exe();
var
iResultCode: Integer;
begin
Exec(ExpandConstant('{tmp}\xxxxx-runtime.exe'), '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode);
end;
procedure SetUninstallString();
var
sUnInstPath: String;
sUnInstallString: String;
begin
exe();
sUnInstPath := ExpandConstant('Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\xxxxx_is1');
sUnInstallString := '';
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, sUnInstPath, 'UninstallString', sUnInstallString) then
RegQueryStringValue(HKEY_CURRENT_USER, sUnInstPath, 'UninstallString', sUnInstallString);
uninstallString := RemoveQuotes(sUnInstallString);
end;