0

Ran into a very strange issue with network shares recently on a particular Windows 10 machine.

I have a network share \\server\sharename mapped to the Z: drive, and am trying to work with files there in the command prompt.

I navigate to Z:\some\folder with Z: then cd some\folder. This works fine, and I can list files in the folder with dir and confirm that cmd's working directory is Z:\some\folder with cd.

However, any programs that I run in that folder, open with C:\WINDOWS as the working directory instead.

So for example, if I want to execute a Python script Z:\some\folder\helloworld.py with python helloworld.py after changing directory to Z:\some\folder, I get a file not found error that C:\WINDOWS\helloworld.py does not exist.

This is also true for any other commands, e.g. notepad helloworld.py complains that the file doesn't exist. Running explorer . will open an Explorer window in C:\Windows instead of Z:\some\folder. If I navigate to the folder with Explorer then type cmd into the address bar, this too opens in C:\Windows.

I confirmed that this is specifically related to network drives, since C: or a USB drive D: have no such problem. If I use the full path name in the command, e.g. python Z:\some\folder\helloworld.py, this works fine too. I have not experienced this issue on any other machine with the same network share mapped to the same letter.

I've scoured Google and haven't even found anyone with a similar problem, which is odd. I've tried re-mapping the share to other drive letters. Ran sfc /scannow and dism /online /cleanup-image /restorehealth just in case. Using Powershell instead of cmd still has the issue.

Any help is appreciated.

0

You must log in to answer this question.

Browse other questions tagged .