Run batch file from network share (vmware shared folder) in Cygwin


ukchucktown

I have some issues with cygwin and mapped network drives. My setup is a bit complicated to work around some of the limitations of our company VPN. I'm running a Windows 10 VM under VMware Fusion and have a shared folder from a Mac host that is mapped to a network drive in Windows. The reason is that b/c I access a remote Git repository using a VPN connection that utilizes a browser plugin which currently only works in Safari. I need to run git commands from a Mac host, but the project's build/development environment is Windows. The VPN browser plugin cannot be installed in any browser under Windows. Hopefully this is a temporary issue, but for now I have to fix it.

In my cygwin environment the mapped drives are not showing up under /cygdrive, probably b/c is a shared folder with hgfs filesystem type. I can mount the shared folder, but when I try to run the 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 UNC paths. I'm able to run commands fine in PowerShell using the mapped drive letter, but I'm not having much luck with cygwin. My desire is to run the VM headless and SSH into the windows environment from the host, so I'd like to work fine in the cygwin environment. Any suggestions?

ukchucktown

I was able to solve the problem by creating a simple script executed from .bash_profile. I basically check if the /cygdrive/h folder exists and if not, execute the script.

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

I tried mapping the drive from Windows, but all attempts failed to register the drive mapping under the /cygdrive folder in cygwin. That's what I'm trying to overcome. Once the mapped drive is placed under /cygdrive, all batch scripts can be executed.

Honestly, I'm still not sure why mapping the drive from Windows doesn't register it as cygwin. And vice versa: if I execute a net command from the terminal, the command is not registered in the explorer.

Related


run "./" bash/batch file with cygwin

Augustine Balashina Good ideas are as follows: I have a bash file for linux which apparently can be run via make ./my_run. The problem was that I was in windows, so I downloaded and installed cygwin. I added cygwin bin to the environment variables and checked

Run a batch from a shared drive on a remote network computer

evening So ultimately what I'd like to do is do this on the company network so that I can execute a batch file stored on a different network drive on a remote computer that will run the install (the batch file has been tested to work) PsExec has little show an

Run a batch from a shared drive on a remote network computer

evening So ultimately what I'd like to do is do this on the company network so that I can execute a batch file stored on a different network drive on a remote computer that will run the install (the batch file has been tested to work) PsExec has little show an

How to write to Windows network share from batch file?

alig227 I have a batch script on my local machine that calls a Python script on a Windows network share, where a file should be written. If I run the Python script without the batch file, it runs successfully. If I run the batch file, I get this error: Traceba

Download file from network shared folder using angular

Nadim Bader I have a network shared folder (\server\folder) and I need to download files (*.zip extension) using angular. I found some resources that can help with downloading files by using rest api, but they didn't help. The requirement is to download them (

Close network share file using batch file

Reese I'm running a robocopy script to backup a server and I'm using net stopand taskkillkilling services and processes that can cause the script to fail or lose important files, but how do I close all open files or folders on a network share (just in case) on

Close network share file using batch file

Reese I'm running a robocopy script to backup a server and I'm using net stopand taskkillkilling services and processes that can cause the script to fail or lose important files, but how do I close all open files or folders on a network share (just in case) on

Unable to create folder from batch file run in C#

XYZ I have a batch file which when run standalone creates a folder. But when I run the same batch file with C# code, I get nothing. I don't know how to debug this. I checked that the path to the batch file is correct. C# code string startupPath = System.IO.Dir

Run a batch file from any folder in Windows 7

Thunderstorm I have a batch file called CreateFolders.bat The code is: @echo off md db in links output Do I have to copy the batch file to a specific folder before I can run it? Is there any option to run a specific batch file via a shortcut key or menu optio

Run a batch file from any folder in Windows 7

Thunderstorm I have a batch file called CreateFolders.bat The code is: @echo off md db in links output Do I have to copy the batch file to a specific folder before I can run it? Is there any option to run a specific batch file via a shortcut key or menu optio

How to run a command from a network path in PowerShell/batch file

Blake Norwood Basically what I want to run is this: cd /d W:\RemoteMirror\ && winscp.com /ini=nul /script=Remote_Mirror_WinSCP.txt or this: cd /d \\fileServer\RemoteMirror\ && winscp.com /ini=nul /script=Remote_Mirror_WinSCP.txt Of course, with SQL Server, I

Run Powershell command from batch file to rename network drive

Agile 82 I'm trying to create a batch file to rename a network drive because "label" doesn't work. I've created a PS1 script that works fine, but I'm trying to put the script into a single batch file so that I can run non-Powershell commands that process multi

Run Powershell command from batch file to rename network drive

Agile 82 I'm trying to create a batch file to rename a network drive because "label" doesn't work. I've created a PS1 script that works fine, but I'm trying to put the script into a single batch file so that I can run non-Powershell commands that process multi