The short filename method may work as well, but I prefer my workaround method
just for clean-looking code. Plus I just have a deep hatred for short
filenames, and there's always that one-in-a-million chance that something
will happen to make it "progra~3". We had an issue recently where a DOS
program had to look for a text file. A backup of the file had been made, and
somehow the two short filenames got switched, causing the DOS app to fail.
--
Bill Baker
"Colin Barnhorst" wrote:
> You never did comment on whether "progra~2" could work for you. Can't you
> use the short filename?
>
> "WB" <(E-Mail Removed)> wrote in message
> news:C49F7B14-DDF4-4F6E-9BF6-(E-Mail Removed)...
> > This is pretty much the same code I had. Unfortunately it sets PROGNAME as
> > "Program Files (x86" with the missing closed parenthesis.
> >
> > My workaround is as follows:
> > SET PROGNAME=Program Files (x86)
> > IF "%PROCESSOR_ARCHITECTURE%"=="x86" SET PROGNAME=Program Files
> >
> > This will also work if PROCESSOR_ARCHITECTURE changes to "AMD128", or
> > "Intel128" like it should be
.
> > --
> > Bill Baker
> >
> >
> > "Pegasus (MVP)" wrote:
> >
> >>
> >> "WB" <(E-Mail Removed)> wrote in message
> >> news:C713DAEC-73F3-42FB-ABE5-(E-Mail Removed)...
> >> > if "%PROCESSOR_ARCHITECTURE%"=="x86" (
> >> > set PROGNAME=Program Files
> >> > ) else if "%PROCESSOR_ARCHITECTURE%"=="AMD64" (
> >> > set PROGNAME=Program Files (x86)
> >> > )
> >> >
> >> > This fails because of the parenthesis in (x86). I have a workaround
> >> > already,
> >> > but I'd prefer using the method above for readability. Any way to
> >> > escape
> >> > the
> >> > parenthesis characters so this will work?
> >> >
> >> > --
> >> > Bill Baker
> >>
> >> Try this:
> >> @echo off
> >> if "%PROCESSOR_ARCHITECTURE%"=="x86" (
> >> set PROGNAME=Program Files
> >> ) else (
> >> if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set PROGNAME=Program Files
> >> (x86)
> >> )
> >>
> >>
> >>
>