-5

I have a batch file (.bat) and I want to convert it to .cmd file:

rem^ &@echo off
rem^ &call :'sub
rem^ &exit /b
:'sub
rem^ &echo begin batch
rem^ &cscript //nologo //e:vbscript "%~f0"
rem^ &echo end batch
rem^ &exit /b
rbaleksandar
  • 8,713
  • 7
  • 76
  • 161
Yahya -_
  • 55
  • 1
  • 1
  • 7

2 Answers2

3

convertBatToCmd.bat:

@echo off
echo ConvertBatToCmd.bat
if not exist "%1" echo call with file to be converted as parameter & goto :eof
ren "%1" "%~n1.cmd"

Usage: convertBatToCmd myfile.bat

(sorry, couldn't resist...)

back to seriousity: more infos here

Community
  • 1
  • 1
Stephan
  • 53,940
  • 10
  • 58
  • 91
1

Try renaming the file from myfile.bat to myfile.cmd

Jahwi
  • 426
  • 3
  • 14