Multiple string manipulation in one go

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
ldoodle
Posts: 18
Joined: 26 Sep 2015 04:01

Multiple string manipulation in one go

#1 Post by ldoodle » 28 Sep 2015 15:35

Hey,

Is it possible to do this in the one SET:

Code: Select all

   for /f "tokens=1* delims=" %%x in ('dir /b /s "%SystemDrive%\mkvtoolnix*.exe"') do set toolsdir=%%~dpx
   set toolsdir=!toolsdir:~0,-1!


I can't quite get the combo right: %%~dp0,-1 for example.

Squashman
Expert
Posts: 4486
Joined: 23 Dec 2011 13:59

Re: Multiple string manipulation in one go

#2 Post by Squashman » 28 Sep 2015 19:19

Why do you need to remove the last byte of the string?

ldoodle
Posts: 18
Joined: 26 Sep 2015 04:01

Re: Multiple string manipulation in one go

#3 Post by ldoodle » 29 Sep 2015 02:53

Because %%~dpx expands to the path including the trailing backslash, which I don't need.

Post Reply