On Tue, 6 Feb 2007 11:26:13 -0000, "Kok Yong Lee" <(E-Mail Removed)>
wrote:
>Hi there,
>
>I have a batch file need to modify the env path according to a keyword
>supplied by user during run time to change the PATH; e.g. mybat debug, mybat
>optimize.
>
>However on certain machine, especially x64 machine, the bracket in the PATH
>has caused me a lot of grief.
>
>for example in the code snippet below, if I run it it always error out as
>"\fred was unexpected at this time.".
>
>Just wodered are there any ways to get around the bracket issue?
>
>thanks.
>
>
>snippet
>----------------
>set path=c:\program files(x68)\fred;%PATH%
>if /i .%1 == .optimize (
> set path=optimize;%PATH%
>)
Ditch the parenthesis:
@echo off
set path=c:\program files^(x68^)\fred;%PATH%
if /i .%1 == .optimize set path=optimize;%PATH%
echo %path%
|