Re: Extracting last Folder Name from complete path

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: andreas kässens (andreas.kaessens_at_simul.de)
Date: 12/02/04


Date: Thu, 2 Dec 2004 12:34:46 +0100


"Michael Bednarek" wrote

> Using 4NT/4DOS, I do this frequently thus:
> ECHO %@WORD["\",-0,C:\temp\ExtendedDB]
>
> 4NT is a commercial product, 4DOS is free

Thanks a lot for your answer! But I have to use the standard Windows xp
commands, which do not have such function. So I tried the following batch:

@echo off
set pfad=D:\Arbeit\PROJEKTE\ATARI 2
for /f "delims=\ tokens=4" %%a in ("@echo %pfad%") do @echo %%a

Unfortunately there seems to be no way to address the last token in general
("tokens=-1" does not work). The only way I can think of, is another for
loop, which counts the "\" in the variing path and replace it with the
tokens value.

This seems to be far too much effort for such a simple task, doesn't it?

Andreas



Relevant Pages

  • Re: Re: Extracting last Folder Name from complete path
    ... But I have to use the standard Windows xp ... >commands, which do not have such function. ... >tokens value. ... Windows: General MVP ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Maybe a much simpler syntax
    ... I found the Whitespace language have a very simple syntax: ... The only lexical tokens in the whitespace language are Space (ASCII ... Many commands require numbers or labels as parameters. ... for positive and [Tab] for negative. ...
    (comp.lang.tcl)
  • Re: What is wrong here?
    ... > movement commands n and s don't work. ... Should a location contain a character or a character ... If you convert the directions to tokens, ... location has N possible routes to other locations. ...
    (comp.lang.cpp)
  • USB undocumented & illegal packets
    ... I'm doing some research on usb tokens and i don't know much about usb ... commands and need some information urgently. ... the internet and have come up with extremely limited info. ...
    (comp.security.misc)
  • How to make RTF document not split tokens
    ... are tokens like. ... I use a bunch of Perl scripts and unix ... commands to manipulate the documents and replace tokens with real data ... The problem is that MS-Word internally splits my tokens like ...
    (microsoft.public.word.general)