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 7055337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:44:10+00:00 2026-05-28T03:44:10+00:00

I have the following script in Powershell ISE . cd E:\Data @ xxxx.zip yyyy.zip

  • 0

I have the following script in Powershell ISE.

cd E:\Data
@"
xxxx.zip
yyyy.zip
"@ -split "`n" | % { echo "'$_'"; test-path -path "$_" -EA Stop }

However it always raises error.

'xxxx.ZIP'
False
Illegal characters in path.
At line:175 char:27
+ % { echo "'$_'"; test-path <<<<  -path "$_" -EA Stop }
    + CategoryInfo          : InvalidArgument: (E:\Data\xxxx.ZIP:String) [Test-Path], ArgumentException
    + FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Commands.TestPathCommand

However, I can run Test-Path -path xxxx.zip or just hard code ‘xxxx.zip’ in the script and it runs fine. What’s the problem of piped string?

Update

If I change the last script to % { echo "'$_'"; "test-path -path $_ -EA Stop" } and copy/paste the output (“test-path -path xxxx.ZIP -EA Stop“) to the command line. It works.

Update

It seems it works in powershell console. An ISE bug?

  • 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-05-28T03:44:11+00:00Added an answer on May 28, 2026 at 3:44 am

    In the ISE the here-string should be split using a carriage return followed by a powershell new line, like this:

    cd E:\Data
    @"
    xxxx.zip
    yyyy.zip
    "@ -split "`r`n" | % { echo "'$_'"; test-path -path "$_" -EA Stop }
    

    When using this function:

    function asciiToHex($a)
    {
    $b = $a.ToCharArray();
    Foreach ($element in $b) {$c = $c + "%#x" + [System.String]::Format("{0:X}",
    [System.Convert]::ToUInt32($element)) + ";"}
    $c
    }
    

    to convert the here-string in the ise we get:

    asciitohex $t
    %#x78;%#x78;%#x78;%#x78;%#x2E;%#x7A;%#x69;%#x70;%#xD;%#xA;%#x79;%#x79;%#x79;%#x79;%#x2E;%#x7A;%#x69;%#x70;
    

    however in the powershell console we get

    asciitohex $t
    %#x78;%#x78;%#x78;%#x78;%#x2E;%#x7A;%#x69;%#x70;%#xA;%#x79;%#x79;%#x79;%#x79;%#x2E;%#x7A;%#x69;%#x70;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a powershell script with the following code in it... $appdir = Split-Path
I have the following snippet of PowerShell script in my profile: . (join-path (split-path
I have a following script in PS: [System.Xml.XmlDocument] $Config; function Get-ScriptDirectory { Split-Path $script:MyInvocation.MyCommand.Path
I have the following string expression in a PowerShell script: select count(*) cnt from
I have the following code snippet from my PowerShell script that... Loops through a
I have the following PowerShell script that will parse some very large file for
I have a powershell script in which I do the following $somePSObjectHashtables = New-Object
I have the following test defined in a psake build script: task package -depends
I have a batch file test.bat to start a powershell script: @pushd C:\myscripts powershell
I have the following tiny PowerShell script that's meant to kill some certain processes

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.