-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
  • 7,904
  • 5
  • 68
  • 131
Yahya -_
  • 43
  • 1
  • 1
  • 5

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
  • 50,835
  • 10
  • 55
  • 88
1

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

Jahwi
  • 426
  • 2
  • 14