@echo off
if {%2}=={} @echo Syntax MakeShort FileName ShortName&goto :EOF
if not exist %1 @echo Syntax MakeShort FileName ShortName - %1 not found.&goto
:EOF
setlocal ENABLEEXTENSIONS
set shortname=%~sn1%~sx1
endlocal&set %2=%shortname%
Usage:
call makeshort "c:\Documents and Settings\username\this has spaces.txt shortname
@echo %shortname%
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.