Skip to content

RaulMerelli/Batch-to-c-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Batch to C++

A code translator from Window/Dos Batch to C++.

Created to partially automate the process of converting code from Batch to C++ and speed up calculations.

Created for those scripts that have become so complicated that they have to be transformed into independent programs.

Compatibility

Batch command C++ command Actually Working? Batch example code (original) C++ example code (converted) Conversion is correct? Details
set - Partially set a=1 a=1; yes
set - Partially set a=%a%+1 a=a+1; yes
set - Partially set a=!b! a=!b!; no Doesn't work with delayed expansion variables
set - Partially set a=%a%%b% a=ab; no Can't concatenate
set /a - Partially set /a a=2+2 a=2+2; yes
set /a - Partially set /a a=%a%+2 a=a+2; yes
set /a - Partially set /a a=!a!+2 a=!a!+2; no Doesn't work with delayed expansion variables
set /a - Partially set /a a=%a%%b%+1 a=ab+1; no Can't concatenate
set /p cin yes set /p a=Insert cout<<"Insert";
cin>>a;
yes
set /p cin yes set /p a= cin>>a; yes
set /p cin yes set /p "a=Insert a: " cout<<"Insert a: ";
cin>>a;
yes
set /p cin yes set /p "a=" cin>>a; yes
set /p cin yes set /p a="Insert a: " cout<<"Insert a:";
cin>>a;
yes
set /p cin yes set /p a="" cin>>a; yes
goto goto yes goto label goto label; yes
label label yes :label label: yes
color system("color"); yes color 0a system("color 0a"); yes
cls system("cls"); yes cls system("cls"); yes
pause system("pause"); yes pause system("pause"); yes
pause system("pause"); yes pause >nul system("pause >nul"); yes
title system("title"); yes title This is a title system("title This is a title"); yes
if if Partially if "%a%"=="%b%" goto label if (a==b)
goto label;
yes
if if Partially if "%a%"=="hi" goto label if (a=="hi")
goto label;
yes
if if Partially if "hi"=="%b%" goto label if ("hi"==b)
goto label;
yes
if if Partially if "1"=="%b%" goto label if (1==b)
goto label;
depends If is a number can't distinct int from string
if if Partially if "%a%"=="1" goto label if (a==1)
goto label;
depends If is a number can't distinct int from string
if if Partially if "%a%"=="%b%" echo hi if (a==b) no Missing cout, only goto works properly after the if
if if Partially if "%a%" EQU "%b%" echo hi unknown no EQU, NEQ, LSS, LEQ, GTR, GEQ are not supported
if if Partially if "%a%"=="%b%"(
echo hi
goto label;)
unknown no Missing cout, only goto works properly after the if
brackets doesn't exist
start system("start") Partially start https://www.website.com system("start https://www.website.com") yes
start system("start") Partially start C:\file.txt ostringstream cmd;
cmd.str("");
cmd.clear();
cmd<<"start C:\file.txt" ;
system(cmd.str().c_str());
yes
start system("start") Partially start https://www.website.com system("start https://www.website.com") yes
for for no unknown no output no "For" is not supported but will be added.
echo cout Partially echo. cout<<endl; yes
echo cout Partially echo %appdata% cout<<appdata<<endl; Partially Not recognized as enviroment variable
echo cout Partially echo hi %a% cout<<"hi "<<a<<endl; yes
echo cout Partially echo hi !a! cout<<"hi !a!"<<endl; no Doesn't work with delayed expansion variables
C:\path\to\program.exe system("C:\path\to\program.exe") No C:\path\to\program.exe no output no external or generic command

Status of version 0.11 - Mantained by Raul Merelli

Changelog

0.11

  • Added support for one line batch files
  • Added support for batch files without @echo off
  • Fixed library detector
  • Program translated from Italian to English

About

A code translator from Window/Dos Batch to C++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published