Justin Liu
Justin Liu

Reputation: 621

Cannot use cd on Windows Powershell. Path not found

Cannot use cd: file not found

When I run

cd C:\Users\zoua2\Downloads\pwa-ecommerce-demo-payment-request-api.zip\pwa-ecommerce-demo-payment-request-api

on powershell. It outputs

cd : Cannot find path 'C:\Users\zoua2\Downloads\pwa-ecommerce-demo-payment-request-api.zip\pwa-ecommerce-demo-payment-request-api' because it does not exist.
At line:1 char:1
+ cd C:\Users\zoua2\Downloads\pwa-ecommerce-demo-payment-request-api.zi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\zoua2\...ent-request-api:String) [Set-Location], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand

Device data:

Operating system: Windows 10 64 bit
PSVersionTable Data:
Name                           Value                                                                                                                                     
----                           -----                                                                                                                                     
PSVersion                      5.1.18362.752                                                                                                                             
PSEdition                      Desktop                                                                                                                                   
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                   
BuildVersion                   10.0.18362.752                                                                                                                            
CLRVersion                     4.0.30319.42000                                                                                                                           
WSManStackVersion              3.0                                                                                                                                       
PSRemotingProtocolVersion      2.3                                                                                                                                       
SerializationVersion           1.1.0.1          

Administrator:Windows PowerShell ISE File Explorer path

Upvotes: 0

Views: 4973

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 174485

You're getting that error because C:\Users\zoua2\Downloads\pwa-ecommerce-demo-payment-request-api.zip\pwa-ecommerce-demo-payment-request-api is not a valid file path.

Windows programmatically unpacks the archive metadata and allows you to seemlessly "browse" the contents in Explorer, but the entries in the archive don't actually exists as files in the underlying file system - not until you unpack the zip file.

If you don't want to unpack the entire archive to disk, do like Explorer does and inspect the archive programmatically before extract anything!

Upvotes: 1

Related Questions