Batch file to reduce length of file name
i download file names like this.. batchengine-6099-1283555555-60054_20100910_0006.era and want to rename them to 600开发者_如何学JAVA54_20100910_0006.era. The names change but format same, need for statement to rename of all big files ending in .era
I don't have access to a Windows box, but something like:
SETLOCAL EnableExtensions EnableDelayedExpansion
FOR %%I IN (batchengine-*.era) DO (
SET NAME=%%~nI
RENAME "%%I" "!NAME:~28!%%~xI"
)
ENDLOCAL
Type FOR /?
, SET /?
, and SETLOCAL /?
in the console for all of the details on the syntax. Hopefully I have something pretty close. You need to introduce new variables within the loop so that you can access the extended syntax to subscript - e.g., !NAME:~28!
selects the substring starting at character 28. The !NAME!
is a delayed expansion reference. The need for this is explained in one of the command synopsis pages.
精彩评论