/build/static/layout/Breadcrumb_cap_w.png

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?


2 Comments   [ + ] Show comments
  • Are you just trying to add a system to the domain? - mikesharp1 10 years ago
  • In this case yes. Our goal is not to have any passwords fixed in scripts.
    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 10 years ago

Answers (0)

Be the first to answer this question

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ