Any way to convert long file name to short file name from cm
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
Any way to convert long file name to short file name from cm

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> File System
Author Message
Peter Steele
Guest





Posted: Fri Sep 24, 2004 2:38 am    Post subject: Any way to convert long file name to short file name from cm Reply with quote

I'd like to be able to take a long file name like

C:\Program Files\LongAppName

and convert it to its equivalent short file name from the command line. For
example if %LNAME% contained the long file name, I'd like to assign %SNAME%
the short file name equivalent. Can this be done without having to resort to
writing an app? Any freebie tools available for this?
Back to top
Jerold Schulman
Guest





Posted: Fri Sep 24, 2004 6:24 pm    Post subject: Re: Any way to convert long file name to short file name fro Reply with quote

On Thu, 23 Sep 2004 15:38:20 -0700, "Peter Steele" <psteele@z-force.com> wrote:

Quote:
I'd like to be able to take a long file name like

C:\Program Files\LongAppName

and convert it to its equivalent short file name from the command line. For
example if %LNAME% contained the long file name, I'd like to assign %SNAME%
the short file name equivalent. Can this be done without having to resort to
writing an app? Any freebie tools available for this?


I just wrote the following script:

You would:
call cvtlfnsfn %lname% sname


@echo off
if {%2}=={} @echo Syntax: CvtLFNSFN LFN SFN&goto :EOF
setlocal
set file=%~nx1
@echo.>"%TMP%\%file%"
:loop
for /f "Tokens=1* Delims=\" %%a in ('dir "%TMP%\%file%" /X^|find "%file%"') do (
set line=%%a
)
del /q "%TMP%\%file%"
for /f "Tokens=1*" %%a in ('@echo %line:~36%') do (
set sfm=%%a
)
endlocal&set %2=%sfm%

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> File System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB