I've tried multiple iterations of the following and nothing worked.
The .bat file needs to accept 2 parameters. $IN and $TIC which are initials and ticket number.
Variables:
$IN = $textboxInitials.Text
$TIC = $textboxTicket.Text
Commands (None of these work):
start "\\Path\InstallOffice.bat" $IN $TIC
start "\\Path\InstallOffice.bat $IN $TIC"
start "\\Path\InstallOffice.bat" KL 562355
cmd.exe /C "\\Path\InstallOffice.bat" KL 562355
& "\\Path\InstallOffice.bat" $IN $TIC
This does work, but it is without parameters.
start "\\Path\InstallOffice.bat"
I am writing a program to install a bunch of programs after our standard build process so the helpdesk can pick and choose what needs installed. This is just the first command to be run, there will be a bunch after it as well, so powershell will need to wait for the .bat file to finish before moving on the the next command.
%1as $IN and%2as $TIC? Does your bat script run natively if you execute it from the cmd console, bypassing the PowerShell script?