Forum Discussion

AndrewCast's avatar
AndrewCast
Contributor
7 years ago

How to set a command line parameter through a script?

I use a script to install and add a new build of the program.

 

I use
 

 

TestedApps.Add


to add the path to the launcher. I was wondering if there's any way to add a command line parameter too? I want it to launch with the:

 

-shortcuts

 

command, such as it would launch as:

 

"C:\Program Files (x86)\Sample Folder\ Sample Launcher.exe" -shortcuts


But when I try to use 

 

TestedApps.Launcher.Params.ActiveParams.CommandLineParameters = "-qashortcuts"


It launches as 

"C:\Program Files (x86)\Sample Folder\ Sample Launcher.exe -shortcuts"


and complete ignores the -shortcuts command

 

Any idea on how to do this? Preferably from adding it I would like the TestedApps to have -shortcuts defined as a command line parameter but that doesn't seem possible.

 

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Suffice it to say... rather than changing the commandline parameters after the fact, when you call the "Add" method, add the parameter to the proper parameter of the Add method.

      Like so.

      function AddingApp(){
          var app = TestedApps.Add('Test.bat','-blah',1,true,'C:\\Temp\\');
      TestedApps.Items(app).Run(); }

      This places the commandline switch in the appropriate place in the TestedApps object and then all you need to do is run the app./

    • AndrewCast's avatar
      AndrewCast
      Contributor

      I guess I use a launcher for consistiencies sake of consistency.

       

      I tend to launch it through TestedApps.Run() but I guess I could work around that. I'll look into the WshShell.Exec method - thanks!

       

      There is no way to do this through TestedApps then?