> -----Message d'origine-----
> De: Jason Dillon [mailto:[EMAIL PROTECTED]]
> Date: samedi 16 f�vrier 2002 02:30
> �: Jboss-Development@Lists. ""Sourceforge. Net
> Objet: [JBoss-dev] Question for win32 batch file gurus
> 
> 
> Is there any way to detect the directory in which a .bat file 
> lives when
> it is running?

%~dp0   or equivalent %~d0%~p0
(translation in human: disk and path of the 0 variable ... you can get also
the name and option)

look in for/? for detail  (why in for/?, because microsoft)

look in set/? call/? for some more...

not that it works only with CMD.EXE NT shell with extension activated (tha
default)..
probably also on 2000, BUT not on 95/98...
this is why it is often not used for most OpenSource project scripts...

for XP ? dunno

classic starting for a runserver.bat :

@echo off
setlocal
set cmd_dir=%~dp0
for /f "tokens=*" %%i in ('cd') do set current_dir=%%i
title "foo bar server"

 ...
goto end
:error
echo problem with....
pause
:end
echo Bye...
endlocal

> 
> Like in sh, I can `dirname $0` to find out where the script lives.
> 
> Is this possible?  If so can some one show me the syntax?
> 
> --jason
> 
> 
> 
> 
> _______________________________________________
> Jboss-development mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-development
> 

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to