Can you try this on win2000? Create test.bat:

@echo off
echo ~dps0: %~dps0
echo ~dp0: %~dp0
echo ~s0: %~s0
echo ~0: %~0

echo ~dps0\..: %~dps0\..
echo ~dps0..: %~dps0..

Then run: "cmd /C test.bat"

I get...
~dps0: c:\home\Brett\
~dp0: c:\home\Brett\
~s0: c:\home\Brett\test.bat
~0: test.bat
~dps0\..: c:\home\Brett\\..
~dps0..: c:\home\Brett\..

So it looks correct, though we could stand to drop the trailing \ as
it seems to incorporate that already.

Perhaps your M2_HOME is set differently outside of the batch file?

- Brett

On 4/17/05, baleineca <[EMAIL PROTECTED]> wrote:
> I'm no batch file expert either and I thought it's was strange, but
> here's what happens with the original line `if "%OS%"=="Windows_NT" SET
> M2_HOME=%~dps0\..`:
> 
> M2_HOME = C:\PROGRA~1\MAVEN-~1.0-A\bin\m2.bat\..
> 
> which points to bin.
> 
> I also thought it was supposed to return the directory, but it's
> returning the file (this is happening on win2000, I've seen batch
> commands behave differently on various win versions, so maybe it's
> correct on winXP?)
> 
> Hence my correction to go up one more from bin...
> 
> 
> Brett Porter wrote:
> > Hi,
> >
> > On 4/17/05, baleineca <[EMAIL PROTECTED]> wrote:
> >
> >>Change line 86 from:
> >>if "%OS%"=="Windows_NT" SET M2_HOME=%~dps0\..
> >>
> >>to
> >>
> >>if "%OS%"=="Windows_NT" SET M2_HOME=%~dps0\..\\..
> >>
> >>(need double \\ to escape)
> >
> >
> > Can you explain this to me? I'm no .bat file wizard, but I thought I
> > tested this.
> > IIRC, %~dps0 is the (d)rive and (p)ath of the batch file (%0), using a
> > (s)hort name.
> >
> > So M2_HOME=c:\maven2\bin\..
> > which is correct. I thought yours would give c:\ in that case.
> >
> > Thanks...
> > - Brett
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to