Gerhard,
Gerhard Hofmann wrote:
Hi Urs,
first of all, thanks for your feedback!
set scriptdir=%dp0
This will determine current working directory, that means the directory where appsonly.bat is located, in my case \\server\install\
set scriptdir=%scriptdir%*
set scriptdir=%scriptdir:\*=%
Looks complicated, but will just strip off the trailing "\" and \\server\install\ will be converted to \\server\install
I just copied this from some old usenet postings in comp.msdos.batch...
Ok, thanks. I have now read the help page for the set command and done a bit of testing. it looks as if the change required is trivial. Thanks for introducing me to this cmd line acrobatics.
> > Any ideas how to strip off the trailing "\bin"?
See attached test1.ba_ file, rename it to test1.bat and copy it to \\install\install\bin and run it.
Regards,
Urs Rau
@echo off
pwd set scriptdir=%~dp0 echo scriptdir is now: %scriptdir% pause set scriptdir=%scriptdir%* echo scriptdir is now: %scriptdir% pause set scriptdir=%scriptdir:\*=% echo scriptdir is now: %scriptdir% pause set scriptdir=%scriptdir:\bin=% echo scriptdir is now: %scriptdir% pause rem set scriptdir=%~dp0 rem set scriptdir=%scriptdir%* rem SET scriptdir=%scriptdir:\*=% rem net use %z% %scriptdir%
