I was creating a script of Powershell as a hobby but it can be a tool to be used to install all the files from a given folder after a install from 0. I'm struggling since I don't see where could be the problem. I'm new to PSH but I'm suspicious that it might be a data problem issue:
Start-Process : Este comando no se puede ejecutar debido al error: El sistema no puede encontrar el archivo especificado.
En línea: 47 Carácter: 5
Start-Process -FilePath "$installArrayMsi" -ArgumentList '/silent ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
- FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
The code:
$nameExe=Get-ChildItem | Where-Object -property name -Like "*.exe" | Get-ChildItem -name
$nameMsi=Get-ChildItem | Where-Object -property name -Like "*.msi" | Get-ChildItem -name
$Location=(Get-Location).path
$Location
$numProgramsExe=$nameExe | Measure-Object -Line | Select-Object -Expand Lines
$numProgramsMsi=$nameMsi | Measure-Object -Line | Select-Object -Expand Lines
$superArrayExe = @($nameExe)
$installArrayExe = @(for ($i = 0; $i -lt $numProgramsExe; $i++)
{
$Location+"\"+$superArrayExe[$i]
}
)
for ($i = 0; $i -lt $numProgramsExe; $i++)
{
Start-Process -FilePath "$installArrayExe" -ArgumentList '/silent', '/install' -Wait
Write-Output "Instalando "$superArrayExe[$i]
Write-Output " "
}
$superArrayMsi = @($nameMsi)
$installArrayMsi = @(for ($i = 0; $i -lt $numProgramsMsi; $i++)
{
$Location+"\"+$superArrayMsi[$i]
}
)
for ($i = 0; $i -lt $numProgramsMsi; $i++)
{
Start-Process -FilePath "$installArrayMsi" -ArgumentList '/silent', '/install' -Wait
Write-Output "Instalando "$superArrayMsi[$i]
Write-Output " "
}