Hallo everybody,
iam at work and i need you to help me fast. I need a string operation.
Input ist a complete path:
example: C:/Test/Test/Test/Test.exe
The output should be only:
Test.exe
can somebody help me quickly?
Thanks a lot
Nico
string operation. thx
Moderator: DosItHelp
Re: string operation. thx
Code: Select all
%comspec% /k for /?
Run & read.
Re: string operation. thx
!k is right, you should read the help of the FOR command.
In your case I would run a for /f loop
You will have the contents of %fullname% in %%a. In %%~nxa the n is for file name and the x is for file extension.
Regards
aGerman
In your case I would run a for /f loop
Code: Select all
@echo off &setlocal
set fullname=C:/Test/Test/Test/Test.exe
for /f "delims=" %%a in ("%fullname%") do set "name=%%~nxa"
echo %name%
pause
You will have the contents of %fullname% in %%a. In %%~nxa the n is for file name and the x is for file extension.
Regards
aGerman