I´m start user in inno Setup, but I need to create an user in Windows with a password that need input during installation.
Like in CheckSerial
where is needed input a name, I need someway to cap this name and other field to insert a password.
On DOS I can create a user with:
net user USER PWD /add /fullname:"USER" /comment:"TEST" /expires:never /passwordchg:no
I got it in
[Run]
Filename: net.exe; parameters: "user USER PWD /add /fullname:""USER"" /comment:""TEST"" /expires:never /passwordchg:no"
But I need input name and password of this user. I think it's possible in [Code]
.
There is a great example on how to get user data from a custom page and use it with {code:FunctionName|Argument}
in other sections: https://github.com/jrsoftware/issrc/blob/master/Examples/CodeDlg.iss
Short overview:
Add a TInputQueryWizardPage
in InitializeWizard
.
[Code]
var
UserPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
UserPage := CreateInputQueryPage(wpWelcome,
'Personal Information', 'Who are you?',
'Please specify your name and password.');
UserPage.Add('Name:', False);
UserPage.Add('Password:', True);
end;
Add a function called GetUser
like that returns the requested value:
function GetUser(Param: String): String;
begin
if Param = 'Name' then
Result := UserPage.Values[0]
else if Param = 'Password' then
Result := UserPage.Values[1];
end;
Use the input data in the Run
command:
[Run]
Filename: net.exe; parameters: "user {code:GetUser|Name} {code:GetUser|Password} /add /fullname:""USER"" /comment:""TEST"" /expires:never /passwordchg:no"