Can a batch script run from a network share location?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
djangofan
Posts: 23
Joined: 04 Nov 2011 12:28

Can a batch script run from a network share location?

#1 Post by djangofan » 17 Jan 2012 13:31

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 . . .

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

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

#2 Post by Ed Dyreen » 17 Jan 2012 13:35

'
You are already doing it :!:

djangofan
Posts: 23
Joined: 04 Nov 2011 12:28

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

#3 Post by djangofan » 17 Jan 2012 14:32

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.

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

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

#4 Post by Ed Dyreen » 17 Jan 2012 14:44

'
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.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

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

#5 Post by Squashman » 19 Jan 2012 07:46

Food for thought

Code: Select all

@echo off
SET MyDIR=%~dp0
echo %MyDIR%
pushd %MyDIR%
echo %CD%
pause
Last edited by Squashman on 19 Jan 2012 07:54, edited 1 time in total.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

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

#6 Post by Squashman » 19 Jan 2012 07:49

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.

Post Reply