Hi Andrew,
> Presumably
> PATH "epicsdir1;epicsdir2;%PATH%"
> will also work (seems to be OK for me), i.e. I just need to add quotes around the whole generated argument.
Unfortunately this syntax embeds the quotes in the PATH
Set "PATH=a;b" -> PATH is a;b
PATH "c;%PATH%" -> PATH now contains "c;a;b" rather than c;a;b
PATH "c;%PATH%" -> PATH now contains "c;"c;a;b""
And multiple additions to the PATH will fail if the original PATH contained an &
Set "PATH=a;b & c"
PATH "c;%PATH%" -> no error printed, path contains "c;a;b & c"
PATH "c;%PATH%"
Now prints 'c""' is not recognized as an internal or external command, operable program or batch file.
And PATH is left containing "c;"c;a;b
I agree the shorter PATH syntax looks nicer, but it may be safer to go with the longer syntax
Regards,
Freddie
-----Original Message-----
From: Andrew Johnson [mailto:[email protected]]
Sent: 24 January 2017 17:44
To: Akeroyd, Freddie (STFC,RAL,ISIS); [email protected]
Subject: Re: dllPath.bat problem
Hi Freddie,
On 01/24/2017 11:02 AM, [email protected] wrote:
> set "PATH=A & B;C"
> PATH C;%PATH%
>
> Prints
> 'B' is not recognized as an internal or external command,
> operable program or batch file.
> and PATH is left containing just C;A
>
> The solution is to quote the entire expression using the syntax
> SET "PATH=epicsdir1;epicsdir2;%PATH%"
> in dllPath.bat
Presumably
PATH "epicsdir1;epicsdir2;%PATH%"
will also work (seems to be OK for me), i.e. I just need to add quotes around the whole generated argument.
I prefer using the slightly shorter PATH command, which also makes it easier for a human to see at first glance that it's adjusting the PATH instead of setting some other variable whose name just begins with PATH.
Done - thanks,
- Andrew
--
Arguing for surveillance because you have nothing to hide is no different than making the claim, "I don't care about freedom of speech because I have nothing to say." -- Edward Snowdon
- Replies:
- Re: dllPath.bat problem Andrew Johnson
- References:
- dllPath.bat problem Mark Rivers
- Re: dllPath.bat problem Andrew Johnson
- RE: dllPath.bat problem Mark Rivers
- Re: dllPath.bat problem Andrew Johnson
- RE: dllPath.bat problem freddie.akeroyd
- Re: dllPath.bat problem Andrew Johnson
- Navigate by Date:
- Prev:
Re: dllPath.bat problem Andrew Johnson
- Next:
Re: dllPath.bat problem Andrew Johnson
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: dllPath.bat problem Andrew Johnson
- Next:
Re: dllPath.bat problem Andrew Johnson
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
<2017>
2018
2019
2020
2021
2022
2023
2024
|