Link to home
Start Free TrialLog in
Avatar of rsolomon
rsolomonFlag for United States of America

asked on

Find root name of file in DOS

How to get the root name of a file, using dos scripting?
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I used  *.txt  as a generic filespec, but it can by any filespec or a specific file.
Note that in a batch file, you must double-up the % symbols as I did above.  If you want to run that straight from a command line (no batch) then use single percents:

for %F in (*.txt) do @echo  %~nF