Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

xEd files based on extension name

Aug
2,799
144
This library function,
xEd
is part of my Utils.Library file.

Use this code as a starting point,
and modify the code to use your extensions and editors.

Code:
xEd {
@SETLOCAL
@ECHO OFF

if defined theEditor unset theEditor

iff %# gt 0 then
  iff not exist %1 then
    echo There are no %1 files in this folder.
    quit
  endiff
endiff

switch %1
case *.ahk
  set theEditor=uedit64.exe
  set thefiles=*.ahk
case *.btm
  set theEditor=TCEdit.exe
  set theFiles=*.btm
case *.md
  set theEditor=mm.exe -nosplash 
  set theFiles=*.md
case *.vbs
  set theEditor=VBSEdit.exe
  set theFiles=*.vbs
case *.*
  set theEditor=uedit64.exe
  set theFiles=*.*
default
  echo USAGE: xEd *.btm
  echo        xEd *.ahk
  echo        xEd *.md
  echo        xEd *.vbs
  echo        xEd *.* 
  echo        xEd 
  quit
endswitch

iff exist %theFiles then
  if defined theFile unset theFile
  select /z set theFile=(%theFiles)
  iff defined theFile then
    set theFile=%@truename[%theFile]
    start %theEditor %theFile
  endiff
endiff
ENDLOCAL
}

Joe
 
Back
Top