Saved Bookmarks
| 1. |
Solve : Getting Characters from a Bat file name.? |
|
Answer» I am in TNCAAK1.BAT which has the command I am in TNCAAK1.BAT which has the command Code: [Select]@echo off REM %0 CONTAINS a batch file's OWN NAME REM USE ~n variable modifier to get name part set myname=%~n0 REM use set shortstring=%longstring:~offset,length% string slicing to get chars REM first char is offset 0 set p1=%myname:~0,1% set p2=%myname:~4,2% REM demonstration echo full name + EXTENSION is %0 echo name part only is %myname% echo the 1st character of name %p1% echo 5th and 6th chars of name %p2% REM delete when satisfied REM call other batch file call AAAAAA.BAT %p1% %p2% |
|