How to add an argument to the command-line of an application?
Currently I have a scripted installation running, installing the complete computer and joining the computer to the domain. The step to join to domain, I now have it as a PowerShell script which is called by a batch script, because running PowerShell directly doesn't work.
Because I don't want to add username and password to any script, I want to add the username and password as an argument to my script in the following way:
commandline: install.bat domain\username password
Install.bat:
powershell.exe -executionpolicy bypass -file "%~dp0install.ps1" %1 %2
install.ps1:
$username=$args[0]
$password=$args[1]
When I try to run this via a scripted install, I receive the error that it cannot find the file. When I then look into the XML, I see the following:
<CommandLine><![CDATA[install.bat domain\username password]]></CommandLine>
<Parameters></Parameters>
With other words, the parameters / arguments are in the wrong place.... In my application, I don't have any option to add parameters, I only have the commandline box to fill, so from the console I just cannot set this correctly?!
I know I can change the xml manually and add the parameters, but I don't want to do this manual action each time I update the Scripted Install....
Sow, how to add an argument to the command-line of an application?
Answers (0)
Be the first to answer this question
But the main issue is that arguments are not working! In the old versions (KBOX), there was a Parameters field within an application. This isn't there anymore and I'm really missing it! Plus I think it's odd that you don't have the option, but in the XML there is a different line for commandline and parameter. If you have that option in the XML, you should have this option in the console too! - rkoene 9 years ago