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

  • SEARCH
  • Home
  • 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 8287267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:59:19+00:00 2026-06-08T11:59:19+00:00

Escaping chars in powershell is just silly. I’ve tried everything I can find to

  • 0

Escaping chars in powershell is just silly. I’ve tried everything I can find to try and escape this pipe in a parameter that I’m passing into a powershell script, but I absolutely cannot escape it. It’s nuts. I make sure to pass the param in single quotes, and have tried all of the powershell/windows escape chars (`,“,\,\,^,^^). Any help is greatly appreciated.

Example of test script:

$cmd = $Args[0] #set first parameter received to $cmd to run with Invoke-Expression (must wrap param in single quotes if it contains spaces)  
write-host $cmd

Calling test script with a pipe containing command:

C:\Windows\System32\cmd.exe /c powershell -executionPolicy Unrestricted -InputFormat none "D:\test_powershell\app\test_wrapper.ps1" 'test1 | test2'

Results:

'test2'' is not recognized as an internal or external command,
operable program or batch file.
  • 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-08T11:59:21+00:00Added an answer on June 8, 2026 at 11:59 am

    A few notes:

    1. You don’t need cmd. Just call PowerShell directly.
    2. -InputFormat can be either Text or XML. None is not a valid value here.
    3. Use the following (which is mentioned in the help too if escaping issues arise):

      powershell "&{ &'D:\test_powershell\app\test_wrapper.ps1' 'test 1 | test2' }"
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Freemarker has the ability to do text escaping using something like this: <#escape x
tried to find the problem for this but nothings really working. Basically, I'm trying
I think this is an escaping issue or something. When I execute the query
What is NUL or NULL byte and how escaping works with NULL byte? Can
Is there any way to insert $_POST['textarea'] into <textarea> without escaping shell special chars?
I must be having some sort of google-block today, because I can't find an
In C you can continue a string literal in the next line escaping the
Possible Duplicate: Escaping equal sign in properties files In a .properties file, can I
(NOTE: This question is not about escaping queries, it's about escaping results) I'm using
Using this rule in a virtual host configuration file leads to double escaping of

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.