I am able to install the software from the Windows CMD with the following command
setup.exe -inputFile C:\my_installer_input.txt
However, I want to achieve the same above using the PowerShell script.
I tried same from the PowerShell like this
Start-Process -FilePath "C:\Matlab R2018b\setup.exe" -inputFile "C:\my_installer_input.txt" -ArgumentList "/S
and it fails to run with the obvious reason -inputFile
parameter is not available for Start-Process
in PowerShell.
PowerShell also runs the native commands directly from PowerShell prompt, which means your command
setup.exe -inputFile C:\my_installer_input.txt
should work directly from the PowerShell prompt.
If you are executing on a remote machine, you can run with Invoke-Command as below.
Invoke-Command -Session $session -ScriptBlock { <YOUR CODE HERE> }
or
Invoke-Command -ComputerName <remote-computername> -ScriptBlock { <YOUR CODE HERE> }
If this is on a remote machine, do something like:
Invoke-Command -Computername ‘x’ -Scriptblock {
Set-Location C:\path\to\file
cmd /c setup.exe /arg1 /arg2
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.