[THIN] Re: OT: Scripting Error
- From: "Jeremy Saunders" <Jeremy.Saunders@xxxxxxxxxxxxxx>
- To: <thin@xxxxxxxxxxxxx>
- Date: Thu, 18 Dec 2008 03:48:47 +1100
Cool...that worked. Thanks Joe J
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On
Behalf Of Joe Shonk
Sent: Thursday, December 18, 2008 12:30 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: OT: Scripting Error
This is error is normal if you are running the script from UNC path.
Since it's a UNC path, DOS doesn't know how to map the current (present)
working directory. In this case, it throws an error and defaults the
working directory to C:\Windows. This script will still run.
The best thing you can do is use the PUSHD and POPD commands.
PUSHD will push the C:\Windows directory onto a stack AND it will
map/assign an unused drive letter to the UNC path (starting with Z:)
POPD will unassign the drive letter and restore the previous working
directory.
So what you want is to put a
PUSHD %~dp0
At the beginning of your script. %~dp0 is the directory path (or UNC
Path) from where the script was launched.
Joe
From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On
Behalf Of Jeremy Saunders
Sent: Tuesday, December 16, 2008 11:24 PM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] OT: Scripting Error
Ok guys and girls...slightly off topic, but something I've noticed with
my cmd scripts when running from a UNC path...
Start the script off with SetLocal
End the script with EndLocal
After the EndLocal, the script returns the message "The filename,
directory name, or volume label syntax is incorrect."
If run from a local drive or a mapped drive, it runs without error.
----------------start of script------------
Setlocal
Echo This is a test
EndLocal
Pause
------------end of script---------------
The DisableUNCCheck registry value has been implemented, but does not
seem to make a difference in relation to the issue.
It's not a pressing issue, but it's one of those things that's doing my
head in, as I cannot find anything on the web suggesting that what I am
doing is wrong.
Has anyone else come across this?
Cheers.
Kind regards,
Jeremy Saunders
Senior Solution Architect - Virtualisation Specialist | Datacom Systems
WA | 29 Oxford Close, West Leederville, WA 6007 Australia
Email: jeremy.saunders@xxxxxxxxxxxxxx | Ph: +61-8-9210-0806 | Mob:
+61-413-441-846 | Fax: +61-8-9380-4226
Personal Blog: http://www.jhouseconsulting.com/index.php
________________________________
Confidentiality and Privilege Notice
This document is intended solely for the named addressee. The
information contained in the pages is confidential and contains legally
privileged information. If you are not the addressee indicated in this
message (or responsible for delivery of the message to such person), you
may not copy or deliver this message to anyone, and you should destroy
this message and kindly notify the sender by reply email.
Confidentiality and legal privilege are not waived or lost by reason of
mistaken delivery to you.
________________________________
#####################################################################################
Confidentiality and Privilege Notice
This document is intended solely for the named addressee. The information
contained in the pages is confidential and contains legally privileged
information. If you are not the addressee indicated in this message (or
responsible for delivery of the message to such person), you may not copy or
deliver this message to anyone, and you should destroy this message and kindly
notify the sender by reply email. Confidentiality and legal privilege are not
waived or lost by reason of mistaken delivery to you.
#####################################################################################
Other related posts: