PDA

View Full Version : Launch Powershell script with specific parameters from Visual Build


teognost
09-09-2020, 02:29 PM
Hello
I need to launch Powershell script with specific parameters from Visual Build.In Input section of the powershell step if i write the parameters as values (File1,File2,File3) everything works ok.But if I want to provide just some parameters and use option "Provide standard input from a string" there is no parameters passed,they remained with empty values.I want to specify into the Powershell step just some parameters and others to remain with default values.See the bld file attached with step1 working ok (all params are passed) and step2 where no param is passed from the input string.

kinook
09-09-2020, 08:57 PM
Standard input is a way to pipe content into the called program, not pass parameters to it per se.

https://www.tutorialspoint.com/batch_script/batch_script_files_pipes.htm

https://kinook.com/VisBuildPro/Manual/powershellinputtab.htm

One option would be to pass the arguments by naming them and then assigning to a hash table in PowerShell.

See attached.

teognost
09-10-2020, 04:43 AM
Thanks a lot!Could you please attach the bld file for version 9?I tried to open it bit it says it was created in a newer version so it cannot be open.

teognost
09-10-2020, 05:04 AM
I downloaded free version of VBP10 and was able to open the sample attached.Powershell script is developed by other person ,I should not change it,Would be great if you have a sample showing how to pass params from standard input using pipe command (if possibile somehow).Or any otther option not implying the change of the powershell script.

kinook
09-10-2020, 09:57 PM
I don't know if there is a way to call a PowerShell script like that, passing only the 1st and 3rd parameter. You can pass just the 1st, or the 1st and 2nd, or the 1st, 2nd, and 3rd, but not the 1st and 3rd. If there is, you can just call PowerShell.exe or pwsh.exe as needed from a Run Program action.

teognost
09-11-2020, 04:17 AM
Ok,in that case I will use Run Program step instead of Powershell step.Thanks!