Rajanand Ilangovan
Rajanand's Blog

Follow

Rajanand's Blog

Follow

How to fix "Can not find path" error in PowerShell?

Rajanand Ilangovan's photo
Rajanand Ilangovan
·Sep 1, 2022·

1 min read

Problem:

When executing a SQL script file, I have got the below error in PowerShell. I was using PowerShell v5 in Windows 10.

Short Error message:

Get-ChildItem : Can not find path 'file path here'

Solution:

This issue has happened when the length of the file path is 260 characters or more. Apparently this issue is there in PowerShell version up to 5.1.

  1. Run the below command in Administrator mode to fix the issue.
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1

Credit: https://stackoverflow.com/a/58418901