在 Inno Setup 中检查安装路径是否有空格和特殊符号

Check installation path for spaces and special symbol in Inno Setup

我找不到检查用户选择的路径是否没有任何空格或特殊字符的解决方案。

你能帮帮我吗?

您可以这样检查 space:

[Code]

function NextButtonClick(CurPageID: Integer): Boolean;
var
  Dir: string;
  Msg: string;
begin
  Result := True;
  if CurPageID = wpSelectDir then
  begin
    Dir := WizardForm.DirEdit.Text;
    if Pos(' ', Dir) > 0 then
    begin
      Msg := 'The path cannot contain spaces';
      if WizardSilent then Log(Msg)
        else MsgBox(Msg, mbError, MB_OK);
      Result := False;
    end;
  end;
end;


您可以考虑使用 SuppressibleMsgBox function: