Chdir (Set-Location) to an unauthorized location on the intermediate path in PowerShell

Asked 5 months ago, Updated 5 months ago, 19 views

I have a question in Powershell.exe or ISE in PowerShell 5.0.

First of all, the behavior below will be as expected.

  • start\\\machine\dir1\dir2\dir3
    (Display dir3 in Explorer)
  • start\\\machine\dir1\dir2
    (Error ← I don't have access to dir2 so it works fine)
  • ls\\\machine\dir1\dir2\dir3
    (The contents of dir3 are listed.OK)

However, the following error occurs.

  • cd\\\machine\dir1\dir2\dir3
    ("Access to path '\\machine\dir1\dir2' has been denied.")

How can I chdir to dir3?
(This is Windows 7 pro)

windows powershell

2022-09-30 13:57

2 Answers

From Comments

Yes, that's possible. At the command prompt, pushd\machine\dir1\dir2
Connect to the Z drive as , where you can start powerhell and it will work.
Then I thought of it and put a symbolic link (mklink) to dir2 in my home directory and cd
I'm not sure about the details, but it may be the same as connecting a drive (subst) or attaching a symbolic link.
Thank you very much。 – Departee

2022-09-30 13:57

As it has not been verified, it is possible, but once you can set it to the network drive, it might be possible.

2022-09-30 13:57

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.