I am trying to create a Setup using Inno Setup. Because I have to install a .msu file, I use the Wusa.exe.
The important code line:
Filename: {sys}\wusa.exe; WorkingDir: {app}; Parameters: {app}\Windows6.1-KB2506143-x64.msu;
Every time I launch the program, it gives me this error and I couldn't figure out a solution yet:
2147942487 "Wrong Parameter."(Commandline:""C:\Windows\system32\wusa.exe" C:\Program Files (x86)\Phone-O-Mat\Windows6.1-KB2506143-x64.msu")
You are missing quotes around the file name. You need these, as the {app} resolves to a path with spaces:
Filename: {sys}\wusa.exe; WorkingDir: {app}; \
Parameters: """{app}\Windows6.1-KB2506143-x64.msu"""
Related
I have made an exe file with Python and now I am trying to make an installer for it. I want to add a command in Inno Setup so after the installation it creates a shortcut to a folder in the installed directory (program folder/mixes). I want the shortcut to be on the desktop. I understand that you do it in the [Icons] sections but the examples I found were making a shortcut to an exe file but I want to make a shortcut to a folder. How do I do that? below is the Inno code:
#define MyAppName "Blender"
#define MyAppVersion "1.5"
#define MyAppExeName "Blender.exe"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
DefaultDirName={autopf}\Cybercrete
DisableProgramGroupPage=yes
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; \
GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Dirs]
Name: "{app}"; Permissions: users-full
[Files]
Source: "C:\CyberCrete\Ver 1.5\Output\Blender\{#MyAppExeName}"; DestDir: "{app}"; \
Flags: ignoreversion
...
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; \
Tasks: desktopicon
Name: "{commondesktop}\Setup"; Filename: "{app}\Setup.exe"; \
WorkingDir: "{pf}\Program"; IconFilename: "{app}\Setup.ico"
[Run]
Filename: "{app}\{#MyAppExeName}"; \
Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; \
Flags: nowait postinstall skipifsilent`
I read many forums but they are about making shortcuts to exe files not folders.
Creating a shortcut to a folder is the same as creating shortcut to a file. Just use the path to the folder as the shortcut target:
[Icons]
Name: "{autodesktop}\My Folder"; Filename: "{app}\My Documents"
Though indeed, you should not store user's documents into app installation folder. Use user's Documents folder or application data folder.
Granting users full permissions to the program's installation folder is an equally bad practice.
Seems like this link explains everything you should need to know about creating shortcuts.
My program makes PDF files as output in a folder called "mixes". I
want to make it easier for the users to access the folder, that's why
I want to make a shortcut to the result folder.
I would highly recommend not to make the output folder in a relative folder in the program files (i.e. in a folder that is located in a location that is based on where the program is installed). This is both not easily found and will often need Admin permissions to write to a folder stored there.
I would recommend placing the folder in Documents (assuming this is Windows) or in AppData, which would make the folder both more easily accessible and will not run into permission issues.
I'm trying to set up an install file that (optionally) installs .NET 5 if it's not already installed.
However, I'm having trouble defining the version of .NET to install in a constant.
My script is set up like this
#define DotNetVersion "5"
...
[Tasks]
Name: "dotnet"; Description: "{cm:DotNet}"; GroupDescription: "{cm:Prerequisites}"
...
[Files]
Source: "..\Dependencies\{#DotNetInstallFile}"; DestDir: {tmp}; \
Flags: deleteafterinstall; AfterInstall: InstallDotNet; \
Check: NetNotInstalled(ExpandConstant('{DotNetVersion}')); Tasks: "dotnet"
When I try running the resulting install file I get the following error:
Internal error: Expression error 'Internal error: Unknown constant "DotNetVersion"'
The function NetNotInstalled works correctly if I replace ExpandConstant('{DotNetVersion}') with '5', but I want to easily be able to change this without modifying more than the defined constants.
I don't get what's wrong here. The Inno Setup docs state that this should be valid.
Using the same constant for any other function seems to work flawlessly.
A variable defined using Inno Setup preprocessor is not Inno Setup constant. Calling ExpandConstant function on it has no effect.
To expand preprocessor variable (or any expression), you can use {#VariableOrExpression} syntax. It's an inline preprocessor directive call, where, when no directive is explicitly specified, the emit is implied. So the {#VariableOrExpression} is the same as {#emit VariableOrExpression}. And as every preprocessor construct, it's evaluated on compile time (contrary to ExpandConstant).
You actually do that correctly already with {#DotNetInstallFile}, so do the same with DotNetVersion:
Source: "..\Dependencies\{#DotNetInstallFile}"; \
DestDir: {tmp}; Flags: deleteafterinstall; AfterInstall: InstallDotNet; \
Check: NetNotInstalled('{#DotNetVersion}'); Tasks: "dotnet"
See also How to use variables \ macros with Inno Setup?
Under the [Run] section I want to change the working directory to the directory from which the installer was executed. For example, if the setup was executed from the Desktop, I want the working directory to point to the Desktop:
Filename: "{app}\setup.exe"; WorkingDir: "{app}"; MinVersion: 0.0,6.0; Flags: skipifsilent
Use the {src} constant. The documentation describes it as:
{src}
The directory in which the Setup files are located. For example: If
you used {src}\MYPROG.EXE on an entry and the user is installing from
"S:\", Setup will translate it to "S:\MYPROG.EXE".
In your case you can use it like:
[Run]
Filename: "{app}\setup.exe"; WorkingDir: "{src}"; MinVersion: 0.0,6.0; Flags: skipifsilent
In my Inno setup script, I have this line:
[Files]
Source: "C:\my.vbs"; DestDir: "C:\folder"; Flags: ignoreversion
[Run]
Filename: "cscript.exe C:\folder\my.vbs"; Description: "{cm:LaunchProgram,my}"; Flags: nowait postinstall skipifsilent runascurrentuser
but when the the installation is finished, it pop up an error saying:
Unable to execute file:
cscript.exe C:\folder\my.vbs
Create process failed; code 2.
the system cannot find the file specified.
When I go to C:\folder, the my.vbs is right there, why would it say it can't find the file?
The Filename parameter, as the name says, is a path to a (executable) file to execute. What in your case is cscript.exe.
The rest are parameters of that executable, which go to the Parameters parameter.
[Run]
Filename: "cscript.exe"; Parameters: "C:\folder\my.vbs"; \
Description: "{cm:LaunchProgram,my}"; \
Flags: nowait postinstall skipifsilent runascurrentuser
I have a folder tree that I copy to C:\ProgramData The software that I am installing (don't blame me for this, I did not architect, write or design it) requires full control for everyone for this data.
So I put the following line in [Files] sectionL
Source: "C:\ProgramData\PFPS\MapDataServer\*"; DestDir: "C:\ProgramData\PFPS\FalconViewCommand"; Flags: ignoreversion createallsubdirs recursesubdirs; Permissions: everyone-full; Excludes: "*.LDF"
yes, this does give everyone full control of each individual file, but the program needs to create files and the folder permissions (directory) are not set for everyone.
I tried to add a [Dirs] section but that did not work:
[Dirs]
Name: "C:\ProgramData\PFPS\FalconViewCommand"; Flags: uninsalwaysuninstall; Permissions: everyone-full
What do the guru's say?
This works for me:
[Dirs]
Name:"{app}\"; Permissions:everyone-modify
What I have been doing is the following RUN at the end, I was finding that the Dirs was not working (yes, I always do a full unistall, when testing install scripts), otherwise how do you know what will happen when the product ships?
I agree with you about {commonappdata} but I am trying to remove randomness till I get to the bottom of the issue.
Here is what I have been trying:
[Run]
Filename: "C:\Windows\System32\icacls.exe"; Parameters: "C:\ProgramData\PFPS\FalconViewCommand /grant:r Users:(OI)(CI)F"; WorkingDir: "{tmp}"; Description: "Changing Directory Permissions"; StatusMsg: "Changing Directory Permissions"