2

I'm having some problems with cygwin and a mapped network drive. My setup is kind of convoluted to deal with some limitations with our corporate VPN. I'm running a Windows 10 VM under VMware Fusion with a shared folder from my Mac host which is mapped to a network drive in Windows. The reason is b/c I access a remote Git repo using a VPN connection that leverages a browser plugin that unfortunately is only working from Safari currently. I need to run git commands from the Mac host but the project's build/development environment is Windows. The VPN browser plugin fails to install in any of the browsers under Windows. Hopefully a temporary problem but one I must workaround for now.

From my cygwin environment the mapped drive does not show up under /cygdrive, possibly b/c it's a shared folder with hgfs file system type. I'm able to mount the shared folder but when I try to run a batch file from the cygwin environment I get the following error:

./OpenCommandPrompt.bat
'\\vmware-host\Shared Folders\grant\Projects\lts\Product'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
The system cannot find the path specified.
'setenv.bat' is not recognized as an internal or external command,
operable program or batch file.
'setclasspath.bat' is not recognized as an internal or external 
command, operable program or batch file.
C:\Windows>

It doesn't like the UNC path. I'm able to run the command fine from a PowerShell using the mapped drive letter but no luck from cygwin. My desire is to run the VM headless and access the Windows environment over SSH from my host so I'd like to get this working from the cygwin environment if possible. Any suggestions?

  • See [CMD does not support UNC paths as current directories](https://stackoverflow.com/a/45072396/3074564). I suggest to rewrite your batch file(s) to work also with UNC paths and independent on what is the current directory. Unfortunately you have not posted the code of the batch file which results in all those error messages on execution. So we can't really help on how to rewrite this batch file. – Mofi Dec 16 '17 at 18:29
  • Look at last two paragraphs in this section. https://en.wikipedia.org/wiki/Batch_file#Setting_a_UNC_working_directory_from_a_shortcut – ACatInLove Dec 16 '17 at 19:47
  • The code was inherited and there are 100 batch files impacted that I'd rather not change. That's why I didn't post batch files. I'm researching fixes that don't require changes to the batch files. – ukchucktown Dec 17 '17 at 15:22

1 Answers1

2

I was able to fix my issue by creating a simple script that I execute from my .bash_profile. I basically check for existence of the /cygdrive/h folder and if it doesn't exist I execute the script.

#!/bin/bash
net use H: '\\vmware-host\Shared Folders\share'

I tried to map the drive from Windows but all attempts to do so failed to register the drive mapping under the /cygdrive folder in cygwin. That was the issue I was trying to overcome. Once I had the mapped drive under /cygdrive, I was able to execute all the batch scripts.

To be honest, I'm still not sure why mapping the drive from Windows does not register it cygwin. The reverse is also true: if I execute the net command from the terminal, it does not register in Explorer.