Page 1 of 1

Can a batch script run from a network share location?

Posted: 17 Jan 2012 13:31
by djangofan
Is it possible to run a batch file from a network share location?

For example, I have this script:

Code: Select all

@ECHO off
ECHO Hello World
pause


And it results in output that looks like this:

Code: Select all

'\\demo.mysite.com\c$\SharedFiles\Batch'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
Hello World
Press any key to continue . . .

Re: Can a batch script run from a network share location?

Posted: 17 Jan 2012 13:35
by Ed Dyreen
'
You are already doing it :!:

Re: Can a batch script run from a network share location?

Posted: 17 Jan 2012 14:32
by djangofan
Ed Dyreen wrote:'
You are already doing it :!:


I don't think so. If I go into a any more complex example, such as using COPY.exe, then it fails to copy with a similar error. Therefore, I am wondering what the secret is, as I currently do not believe it is possible.

Re: Can a batch script run from a network share location?

Posted: 17 Jan 2012 14:44
by Ed Dyreen
'
Try DOSKIT (XP 32bit OS), to see a working example, I develop it and can be installed from UNC path: viewtopic.php?f=3&t=1893
You should go local as soon as possible, even if it were only for performance related issues.

Re: Can a batch script run from a network share location?

Posted: 19 Jan 2012 07:46
by Squashman
Food for thought

Code: Select all

@echo off
SET MyDIR=%~dp0
echo %MyDIR%
pushd %MyDIR%
echo %CD%
pause

Re: Can a batch script run from a network share location?

Posted: 19 Jan 2012 07:49
by Squashman
djangofan wrote:I don't think so. If I go into a any more complex example, such as using COPY.exe, then it fails to copy with a similar error. Therefore, I am wondering what the secret is, as I currently do not believe it is possible.

xcopy supports UNC paths.