Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8713633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:23:24+00:00 2026-06-13T05:23:24+00:00

Wondering how I could pass an array as command line argument to an exe

  • 0

Wondering how I could pass an array as command line argument to an exe file in powershell? Here is what I am currently working on

I am calling an exe file from a powershell function in the following format

$firstParam = "test1"
$secondParam = "test2"

$thirdParam = @()
$thirdParam = 'test3'
$thirdParam = $thirdParam + 'test4'

[void](& '..\SomeApp.exe' "$firstParam" "$secondParam" "$thirdParam"

Here is what I am seeing as the input arguments in the Application.exe

Debugging information in the application
The third input parameter that was passed from the powershell was an array but it got concatenated (space separated) when passed to the exe file.

Is it possible to pass “test3” as the third argument and “test4” as the fourth argument?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T05:23:25+00:00Added an answer on June 13, 2026 at 5:23 am

    $thirdParam cannot be an array with your implementation. When you write $thirdParam = @(), you do declare an empty array, but then you re-assign it to a string: $thirdParam = 'test3' and then to another string $thirdParam = $thirdParam + 'test4'. I am still not clear about your original intent, but here’s how you would pass test3 as third argument and test4 as the fourth:

    $fourthParam = 'test4'
    [void](& '..\SomeApp.exe' "$firstParam" "$secondParam" "$thirdParam" "$fourthParam"
    

    If you only have 2 fixed parameters, and you can have N parameters, switch to Invoke-Expression instead of Invoke-Command:

    [void](Invoke-Expression "..\SomeApp.exe $firstParam $secondParam $thirdParam"
    

    and make sure your parameters are correctly quoted. In this case, if $thirdParam contains spaces, it will determine your parameter #4 and onwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm wondering if someone could look over my code. I'm trying to pass a
Hi sorry still learning here and slow to learning code arguments. Just wondering could
I was wondering how could I remove one (wrongly inserted) entry/word from the ispell
I was wondering if I could have some pseudo code for working out the
I was wondering if I could pass a IEnumerable Collection into a Javascript method
I was wondering how I could pass a string that I made with javascript
I was wondering if I could pass a List of types as generic parameter.
I could pass in a params[:action_callback], but wondering if there is a more elegant
Currently I am making a new module and I was wondering how could I
i am wondering could i access my app internal storage using emulator. I mean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.