Jump to content

Truncating File Names in CMD


Recommended Posts


If you wish to remove so many letter then yes... if you wish to remove certain letters, no... well, not easily. Please elaborate more.

You set a variable with the information you want to work with...

Then you can use the following:

%variable:~3%
%variable:~5,6%
%variable:~2,-7%
%variable:~-10,3%
%variable:~-15,-6%

First one will remove the first 3 characters

Second one will remove the first 5 characters and only display the next 6 characters

Third one will remove the first 2 characters and display everything but the last 7 characters

Forth one will be the last 10 characters but only display the first 3 characters of that set

Fifth one will be the last 15 characters but only display the last 6 characters of that set (kinda worthless, but works nonetheless...)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...