Batch file Windows 7 - Copying from \\sharename
Posted on 2014-03-07
I used to have a simple batch file we would run in our Windows XP environment that no longer works in Windows 7. I've tried changing the batch file, but still can't get it working. All this batch file does is copy about 6 files from a network share and place them in various locations on the C: drive. For example, each line says something like:
copy \\sharename\install\file1.txt c:\test (this would copy the file "file1.txt" in my \\share\install folder to the folder called "test" on my c: drive)
For some reason in Windows 7, UNC paths with the \\ don't seem to work in batch files any more. So, my solution was to do a temporary drive map to the network share at the beginning of the batch file, then disconnect the drive mapping at the end of the batch file. So at the beginning of my batch file, I put in:
net use g: \\sharename\install
But, I get a "System error 3 has occurred" when I run the script.
First question: Why is the behavior of such a simple batch file different in Windows 7 compared to Windows XP?
Second question: Why am I getting system error 3 when trying to map a drive?