📜 ⬆️ ⬇️

Compiling sources (cpp, cs) with Visual Studio compiler without running IDE on Windows

Often there is no need to run the heavyweight Visual Studio IDE to compile small applications, run any tests of code that does not require full-scale debugging. In such cases, you can quickly build the application in console mode using the capabilities provided by the Microsoft compiler (cl.exe) and IDE launch modules (devenv.exe, msdev.exe). The following is the code for the script files (cmd) of the Windows command line interpreter, which with a few changes, everyone can customize themselves, taking into account the paths to Visual Studio in their system.

Compiling cpp files

Vc ++ _ script code compile_and_link.cmd
:: --------------------------------------------------------------------------- :: ::       : :: :: sVSPath -     Visual C++, :: :: sVSPathName -      Visual C++ :: :: (    sVSPath, sVSPathName   .:: :: --------------------------------------------------------------------------- :: echo off cls echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- :: -------------------------------------- :: ::   ( ) :: :: -------------------------------------- :: set gavSrc=MySource1.cpp MySource2.cpp :: -------------------------------------- :: :: ,  ,  Qt :: :: -  , Q_OBJECT:: ::     moc_xxx.cpp :: :: -------------------------------------- :: ::set gavSrcQtMoc=gavQtSignalSlot.h set gavSrcQtMoc="" :: -------------------------------------- :: ::  : :: :: 6 - VC6, :: :: 8 - VC8 (2005), :: :: 9 - VC9, :: :: 10 - VC10 (2010) :: :: 11 - VC11 (2012) :: :: -------------------------------------- :: set iCompVer=11 :: -------------------------------------- :: ::  : :: :: 0 - release, :: :: 1 - debug, :: :: 2 -    :: :: ( ) :: :: -------------------------------------- :: set iModeComp=1 :: -------------------------------------- :: ::   : :: :: 0 - , 1 -  :: :: -------------------------------------- :: set bLibQt=0 set bLibCrt=0 set bLibBoost=0 :: -------------------------------------- :: ::    Qt: :: :: 0 - shared (), :: :: 1 - static () :: :: -------------------------------------- :: set iModeQt=0 :: -------------------------------------- :: ::   WINDDK :: :: 0 -   :: :: 1 - WINDDK  Win2000, WinXP :: :: (   ..  :: :: gavIncPathDdkXP,gavLibPathDdkXP:: :: - . ) :: :: -------------------------------------- :: set iWinddk=0 :: -------------------------------------- :: ::    :: :: (   : -D ) :: :: -------------------------------------- :: ::set gavCompilFlags=-Dtest :: -------------------------------------- :: ::   ( ) :: :: -------------------------------------- :: :: Win32 character-mode application: set gavSubsystem=CONSOLE :: Application does not require a console: ::set gavSubsystem=WINDOWS :: Device drivers for Windows NT: ::set gavSubsystem=NATIVE :: Application that runs with the POSIX subsystem in Windows NT: ::set gavSubsystem=POSIX :: Application that runs on a Windows CE device: ::set gavSubsystem=WINDOWSCE :: -------------------------------------- :: ::   Visual Studio. :: :: !!!   !!! :: :: -------------------------------------- :: :: VS6 (!!    VS6 ..     -   ) if %iCompVer%==6 set sVSPath=C:\Progs\VC98 if %iCompVer%==6 set sVSPathName=%sVSPath%\bin\cl.exe :: VS8 if %iCompVer%==8 set sVSPath=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 8\VC if %iCompVer%==8 set sVSPathName=%sVSPath%\bin\cl.exe :: VS9 if %iCompVer%==9 set sVSPath=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 9.0\VC if %iCompVer%==9 set sVSPathName=%sVSPath%\bin\cl.exe :: VS10 if %iCompVer%==10 set sVSPath=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 10.0\VC if %iCompVer%==10 set sVSPathName=%sVSPath%\bin\cl.exe :: .  VS2010: if %iCompVer%==10 set gavIncPathMy=%SYSTEMDRIVE%\Program Files\Microsoft SDKs\Windows\v7.0A\Include if %iCompVer%==10 set gavLibPathMy=%SYSTEMDRIVE%\Program Files\Microsoft SDKs\Windows\v7.0A\Lib :: VS11 if %iCompVer%==11 set sVSPath=%SYSTEMDRIVE%\Program Files (x86)\Microsoft Visual Studio 11.0\VC if %iCompVer%==11 set sVSPathName=%sVSPath%\bin\cl.exe :: .  VS2010: if %iCompVer%==11 set gavIncPathMy=%SYSTEMDRIVE%\Program Files (x86)\Windows Kits\8.0\Include\um if %iCompVer%==11 set gavIncPathMy2=%SYSTEMDRIVE%\Program Files (x86)\Windows Kits\8.0\Include\Shared if %iCompVer%==11 set gavLibPathMy=%SYSTEMDRIVE%\Program Files (x86)\Windows Kits\8.0\Include\Lib if %iCompVer%==11 set gavLibPathMy2=%SYSTEMDRIVE%\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x86 ::if %iCompVer%==11 set gavLibPathMy2=%SYSTEMDRIVE%\Program Files (x86)\Windows Kits\8.0\Lib\win8\um\x64 echo Compilator version: VC%iCompVer% echo Compilator path: %sVSPathName% :: -------------------------------------- :: ::   Boost :: :: -------------------------------------- :: set BOOST_ROOT=C:\Progs\boost\boost_1_49_0 :: -------------------------------------- :: ::     :: :: .     :: ::   ! :: :: -------------------------------------- :: set gavIncPathVS="%sVSPath%\include" set gavIncPathQt="%QTDIR%\include" set gavIncPathBoost="%BOOST_ROOT%" set gavIncPathDdkCrt="C:\Progs\WINDDK\2600.1106\inc\crt" set gavIncPathDdkXP="C:\Progs\WINDDK\2600.1106\inc\w2k" if not "%gavIncPathMy%"=="" (set gavIncPathAll=-I"%gavIncPathMy%" if not "%gavIncPathMy2%"=="" ( set gavIncPathAll=-I"%gavIncPathMy%" -I"%gavIncPathMy2%" ) ) if %iWinddk%==1 (set gavIncPathAll=%gavIncPathAll% -I%gavIncPathDdkCrt% -I%gavIncPathDdkXP%) if not %gavIncPathVS%=="" (set gavIncPathAll=%gavIncPathAll% -I%gavIncPathVS%) if %bLibQt%==1 (if not %gavIncPathQt%=="" (set gavIncPathAll=%gavIncPathAll% -I%gavIncPathQt%)) if %bLibBoost%==1 (if not %gavIncPathBoost%=="" (set gavIncPathAll=%gavIncPathAll% -I%gavIncPathBoost%)) echo Include pathes: %gavIncPathAll% :: -------------------------------------- :: ::     (.lib) :: :: .     :: ::   ! :: :: -------------------------------------- :: set gavLibPathDdkXP=C:\Progs\WINDDK\2600.1106\lib\wxp\i386 set gavLibPathVS=%sVSPath%\lib set gavLibPathAll="" if %iWinddk%==1 (set gavLibPathAll=%gavLibPathAll% /LIBPATH:"%gavLibPathDdkXP%") if not "%gavLibPathVS%"=="" (set gavLibPathAll=%gavLibPathAll% /LIBPATH:"%gavLibPathVS%") if not "%gavLibPathMy%"=="" (set gavLibPathAll=%gavLibPathAll% /LIBPATH:"%gavLibPathMy%" if not "%gavLibPathMy2%"=="" ( set gavLibPathAll=%gavLibPathAll% /LIBPATH:"%gavLibPathMy%" /LIBPATH:"%gavLibPathMy2%" ) ) set gavLibPathBoost="%BOOST_ROOT%\stage\lib" if %bLibBoost%==1 (if not %gavLibPathBoost%=="" (set gavLibPathAll=%gavLibPathAll% /LIBPATH:%gavLibPathBoost%)) set gavLibPathQtReleaseShared="%QTDIR%\lib\release\shared" set gavLibPathQtReleaseStatic="%QTDIR%\lib\release\static" set gavLibPathQtDebugShared="%QTDIR%\lib\debug\shared" set gavLibPathQtDebugStatic="%QTDIR%\lib\debug\static" if %bLibQt%==1 ( if %iModeComp%==0 ( if %iModeQt%==0 ( echo Qt mode: release shared set gavLibPathAll=%gavLibPathAll% /LIBPATH:%gavLibPathQtReleaseShared% ) if %iModeQt%==1 ( echo Qt mode: release static set gavLibPathAll=%gavLibPathAll% /LIBPATH:%gavLibPathQtReleaseStatic% ) ) if %iModeComp%==1 ( if %iModeQt%==0 ( echo Qt mode: debug shared set gavLibPathAll=%gavLibPathAll% /LIBPATH:%gavLibPathQtDebugShared% ) if %iModeQt%==1 ( echo Qt mode: debug static set gavLibPathAll=%gavLibPathAll% /LIBPATH:%gavLibPathQtDebugStatic% ) ) ) echo Lib pathes: %gavLibPathAll% :: -------------------------------------- :: ::   run-time. :: ::      :: :: -------------------------------------- :: set gavLibFilesCrt="" if %bLibCrt%==1 (set gavLibFilesCrt=user32.lib ole32.lib Gdi32.lib Ws2_32.lib Imm32.lib Comdlg32.lib Winspool.lib Advapi32.lib) if not "%gavLibFilesCrt%"=="" (set gavLibFilesAll=%gavLibFilesCrt%) :: -------------------------------------- :: ::   Qt. :: :: -------------------------------------- :: set gavLibFilesQtShared=qtmain.lib qt-mt333.lib set gavLibFilesQtStatic=qtmain.lib qt-mt.lib if %bLibQt%==1 ( if %iModeQt%==0 (set gavLibFilesAll=%gavLibFilesAll% %gavLibFilesQtShared%) if %iModeQt%==1 (set gavLibFilesAll=%gavLibFilesAll% %gavLibFilesQtStatic%) ) echo Lib files: %gavLibFilesAll% :: -------------------------------------- :: ::    :: :: -------------------------------------- :: if %iModeComp%==0 ( set gavLinkMode=/RELEASE ::  DLL: set gavCompMode=/MD set gavCompMode=/MT set gavOptimize=/O2 /GA ) if %iModeComp%==1 ( set gavLinkMode=/DEBUG ::  DLL: set gavCompMode=/MDd set gavCompMode=/MTd ::set gavOptimize=/Od /ZI set gavOptimize=/Od /Z7 ) if %iModeComp%==2 ( set gavLinkMode= set gavCompMode= set gavOptimize=/Zg ) if %bLibQt%==1 (if %iModeQt%==1 (set gavCompMode=/MDd)) :: -------------------------------------- :: ::    :: :: -------------------------------------- :: if not %gavSubsystem%=="" (set gavLinkSubsys=/SUBSYSTEM:%gavSubsystem%) :: -------------------------------------- :: ::   :: :: -------------------------------------- :: if %bLibQt%==1 ( if %iModeQt%==0 (set gavCompilFlags=%gavCompilFlags% -DQT_DLL) ) :: -------------------------------------- :: ::    :: :: -------------------------------------- :: set gavOldObj=%gavSrc:.cpp=.obj,% set gavOldObj=%gavOldObj:.c=.obj,% set gavOldAsm=%gavOldObj:.obj=.asm% for /F "tokens=1" %%A in ("%gavSrc%") do (set gavMainName=%%A) set gavMainName=%gavMainName:.cpp=% set gavMainName=%gavMainName:.c=% set gavDelExt= %gavMainName%.exe, %gavMainName%.pdb, %gavMainName%.ilk, %gavOldObj% %gavOldAsm% __vc++_%gavMainName%.log echo. echo Deleting old files: %gavDelExt% ... echo. del %gavDelExt% echo. echo ------------------ echo Compiling start... echo ------------------ echo. if %bLibQt%==1 (if not %gavSrcQtMoc%=="" ( echo ------------------ echo Mocing file... echo ------------------ echo on %QTDIR%\bin\moc %gavSrcQtMoc% -o moc_%gavSrcQtMoc%.cpp @echo off set gavSrc=%gavSrc% moc_%gavSrcQtMoc%.cpp )) echo on "%sVSPathName%" /EHsc %gavIncPathAll% %gavCompilFlags% /Fa %gavSrc% %gavCompMode% %gavOptimize% /link %gavLinkSubsys% %gavLinkMode% %gavLibPathAll% %gavLibFilesAll%>"__vc++_%gavMainName%.log" @echo off echo. echo ------------------ echo Compiling end... echo ------------------ echo. echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- :: -------------------------------------- :: pause 



The main parameters that should be configured once in the above scenario:
1) in the "Paths to Visual Studio" section, you must specify the paths to files of different versions of Visual Studio (if you have several of them installed):
  • sVSPath is the path to the main Visual Studio directory ie to the root directory, which contains all other subdirectories for this version of VS.
  • gavIncPathMy - it is possible for VS 11.0 you will need to specify your own paths to include header files.


2) in the “Paths to Boost” section, you can set BOOST_ROOT - the path to the root directory of the Boost library (if you have it installed).
3) in the "Configuring paths to include files" section, if necessary, you can specify the paths to the Qt and WinDDK header files.
4) in the section “Configuring Library Paths (.lib) Files”, specify the paths to library files (in particular, for WinDDK).
')
Less commonly, it may be necessary to adjust the following parameters for a specific project:
iCompVer - the version of the compiler used (6 - for VC6, 8 - VC8 (2005), 9 - VC9, 10 - VC10 (2010), 11 - VC11 (2012).
gavLibFilesQtShared - the names of .lib files for the dynamic link library Qt;
gavLibFilesQtStatic - the names of the .lib files for the statically linked Qt library.
gavLibFilesCrt - the names of the .lib files for the standard dynamic libraries used in Windows.
iModeQt is the link mode of the Qt library.
gavCompMode - compilation mode flags (single-threaded, multi-threaded, etc.).
gavOptimize - code optimization flags by the compiler.

Most often, you have to change the parameters:
gavSrc - source file names, separated by a space (if there are several).
bLibQt - flag (0/1) of the need to use the Qt library when building an application.
bLibCrt - flag (0/1) of the need to use standard Windows CRT libraries when building an application.
bLibBoost - flag (0/1) of the need to use the Boost library when building the application.
gavSubsystem - subsystem of the created application: CONSOLE - console, WINDOWS - with a graphical interface.

The result (errors, messages) of the compilation can be viewed in the __vc ++ _ XXX.log file, where XXX is the name of the main source file

Building a cpp application from project files

Similarly, without running the IDE, you can build a project using project files and workspaces (dsp, dsw).
Vc ++ script code _ dsp_dsw_compile.cmd
 ::        sVSPathName, ::       Visual Studio   ::   sVSPathName    ... @echo off cls echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- :: -------------------------------------- :: ::    (dsp)   (dsw): set sPrjFile=MyWorkspace.dsp :: -------------------------------------- :: ::  : 0 - release, 1 - debug, 2 - release  debug: set iMode=2 :: -------------------------------------- :: ::   : :: 0 -   , :: 1 -   , :: 2 -    (  iMode=2) set iSubMode=2 :: -------------------------------------- :: ::  : if %sPrjFile:.dsp=% == %sPrjFile% ( set sPrjName=%sPrjFile:.dsw=% ) ELSE ( set sPrjName=%sPrjFile:.dsp=% ) ::   -   release: set sConfigNameRelease="%sPrjName% - Win32 Release" ::   -   debug: set sConfigNameDebug="%sPrjName% - Win32 Debug" :: -------------------------------------- :: ::   Visual Studio: :: set sVSPathName=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 6.0\Common\MSDev98\Bin\MSDEV.EXE :: set sVSPathName=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe :: set sVSPathName=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe :: -------------------------------------- :: :: : if %iSubMode%==0 ( set iCompMode=/CLEAN ) if %iSubMode%==1 ( set iCompMode= ) if %iSubMode%==2 ( set iCompMode=/REBUILD ) :: -------------------------------------- :: echo. echo --------------------------------- echo [%sPrjName%]: compiling start... echo --------------------------------- echo. @echo off if %iMode%==0 ( ::  release: echo [%sPrjName%]: configuration mode: echo %sConfigNameRelease% echo on "%sVSPathName%" %sPrjFile% /MAKE %sConfigNameRelease% %iCompMode% /OUT __vc++_compile_release.log ) @echo off if %iMode%==1 ( ::  debug: echo [%sPrjName%]: configuration mode: echo %sConfigNameDebug% echo on "%sVSPathName%" %sPrjFile% /MAKE %sConfigNameDebug% %iCompMode% /OUT __vc++_compile_debug.log ) @echo off if %iMode%==2 ( ::  release  debug: echo [%sPrjName%]: configuration modes: echo %sConfigNameRelease% echo %sConfigNameDebug% echo on "%sVSPathName%" %sPrjFile% /MAKE %sConfigNameRelease% %iCompMode% /OUT __vc++_compile_release.log "%sVSPathName%" %sPrjFile% /MAKE %sConfigNameDebug% %iCompMode% /OUT __vc++_compile_debug.log ) @echo off echo. echo --------------------------------- echo [%sPrjName%]: compiling end. echo --------------------------------- echo. echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- :: -------------------------------------- :: pause 



Compiling cs files

The above functionality is also implemented for C #:
Vc script code # _compile_and_link.cmd
 :: --------------------------------------------------------------------------- :: ::       : :: :: sVSPath -     Visual C#, :: :: sVSPathName -      Visual C# :: :: (  sVSPath, sVSPathName   .:: :: --------------------------------------------------------------------------- :: echo off cls echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- :: -------------------------------------- :: ::   ( ) :: :: -------------------------------------- :: set gavSrc=Program.cs :: -------------------------------------- :: ::  : :: :: 0 - release, :: :: 1 - debug, :: :: -------------------------------------- :: set iModeComp=1 :: -------------------------------------- :: ::   ( ) :: :: -------------------------------------- :: :: /target:exe     ( ) ( : /t:exe) set gavSubsystem=exe :: /target:winexe    Windows ( : /t:winexe) ::set gavSubsystem=winexe :: /target:library   ( : /t:library) ::set gavSubsystem=library :: /target:module  ,        ( : /t:module) ::set gavSubsystem=module :: /target:appcontainerexe    Appcontainer ( : /t:appcontainerexe) ::set gavSubsystem=appcontainerexe :: /target:winmdobj      Windows,  WinMDExp ( : /t:winmdobj) ::set gavSubsystem=winmdobj :: -------------------------------------- :: ::   ( ) :: :: (x86, Itanium, x64, arm  anycpu. :: ::   : anycpu.) :: :: -------------------------------------- :: set gavPlatform=anycpu :: -------------------------------------- :: ::    :: :: -------------------------------------- :: ::set gavCompilFlags= :: -------------------------------------- :: ::   Visual Studio. :: :: !!!   !!! :: :: -------------------------------------- :: set sVSPath=%WINDIR%\Microsoft.NET\Framework\v4.0.30319 set sVSPathName=%sVSPath%\csc.exe :: -------------------------------------- :: ::     :: :: .     :: ::   ! :: :: -------------------------------------- :: set gavIncPathVS="%sVSPath%" if not "%gavIncPathMy%"=="" (set gavIncPathAll=-I"%gavIncPathMy%") if not %gavIncPathVS%=="" (set gavIncPathAll=%gavIncPathAll% -I%gavIncPathVS%) echo Include pathes: %gavIncPathAll% :: -------------------------------------- :: ::     (.lib) :: :: .     :: ::   ! :: :: -------------------------------------- :: set gavLibPathVS=%sVSPath% if not "%gavLibPathVS%"=="" (set gavLibPathAll=/lib:"%gavLibPathVS%") if not "%gavLibPathMy%"=="" (set gavLibPathAll=%gavLibPathAll% /lib:"%gavLibPathMy%") echo Lib pathes: %gavLibPathAll% :: -------------------------------------- :: ::   run-time. :: ::      :: :: -------------------------------------- :: :: set gavLibFilesCrt=user32.lib ole32.lib Gdi32.lib Ws2_32.lib Imm32.lib Comdlg32.lib Winspool.lib Advapi32.lib ::set gavLibFilesCrt="" if not "%gavLibFilesCrt%"=="" (set gavLibFilesAll=%gavLibFilesCrt%) echo Lib files: %gavLibFilesAll% :: -------------------------------------- :: ::    :: :: -------------------------------------- :: if %iModeComp%==0 ( set gavCompilFlags=%gavCompilFlags% /D:_RELEASE set gavCompMode=/debug- set gavOptimize=/optimize+ ) if %iModeComp%==1 ( set gavCompilFlags=%gavCompilFlags% /D:_DEBUG set gavCompMode=/debug+ set gavOptimize=/optimize- ) :: -------------------------------------- :: ::    :: :: -------------------------------------- :: if not %gavSubsystem%=="" (set gavLinkSubsys=/t:%gavSubsystem%) :: -------------------------------------- :: set gavDelExt=*.obj, *.exe, *.log, *.pdb echo. echo Deleting old files: %gavDelExt% ... echo. del %gavDelExt% echo. echo ------------------ echo Compiling start... echo ------------------ echo. echo on "%sVSPathName%" %gavDefine% %gavCompilFlags% %gavCompMode% %gavOptimize% %gavLinkSubsys% /utf8output /fullpaths /platform:%gavPlatform% %gavLibPathAll% %gavLibFilesAll% %gavSrc%>__vc#_compile.log @echo off echo. echo ------------------ echo Compiling end... echo ------------------ echo. echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- :: -------------------------------------- :: pause 



Building a cs application from solution files (sln) and projects (csproj)

Vc script code # _sln_csproj_compile.cmd
 ::        sVSPathName, ::       Visual Studio   ::   sVSPathName    ... @echo off cls echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- :: -------------------------------------- :: ::    (.csproj)   (sln): set sPrjFile=MyProject.csproj :: -------------------------------------- :: ::  : 0 - release, 1 - debug, 2 - release  debug: set iMode=2 :: -------------------------------------- :: ::   : :: 0 -   , :: 1 -   , :: 2 -    (  iMode=2) set iSubMode=2 :: -------------------------------------- :: ::  : if %sPrjFile:.sln=% == %sPrjFile% ( set sPrjName=%sPrjFile:.sln=% ) ELSE ( set sPrjName=%sPrjFile:.csproj=% ) ::   -   release: :: set sConfigNameRelease="Release|Win32" set sConfigNameRelease="Release" ::   -   debug: :: set sConfigNameDebug="Debug|Win32" set sConfigNameDebug="Debug" :: -------------------------------------- :: ::   Visual Studio: set sVSPathName=%SYSTEMDRIVE%\Program Files (x86)\Microsoft Visual Studio\11.0\Common7\IDE\devenv.exe :: set sVSPathName=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe :: set sVSPathName=%SYSTEMDRIVE%\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe :: -------------------------------------- :: :: : if %iSubMode%==0 ( set iCompMode=/Clean ) if %iSubMode%==1 ( set iCompMode= ) if %iSubMode%==2 ( set iCompMode=/Rebuild ) :: -------------------------------------- :: echo. echo --------------------------------- echo [%sPrjName%]: compiling start... echo --------------------------------- echo. @echo off if %iMode%==0 ( ::  release: echo [%sPrjName%]: configuration mode: echo %sConfigNameRelease% echo on "%sVSPathName%" %sPrjFile% /Build %sConfigNameRelease% /Out __vc#_compile_release.log ) @echo off if %iMode%==1 ( ::  debug: echo [%sPrjName%]: configuration mode: echo %sConfigNameDebug% echo on "%sVSPathName%" %sPrjFile% /Build %sConfigNameDebug% /Out __vc#_compile_debug.log ) @echo off if %iMode%==2 ( ::  release  debug: echo [%sPrjName%]: configuration modes: echo %sConfigNameRelease% echo %sConfigNameDebug% echo on "%sVSPathName%" %sPrjFile% /Build %sConfigNameRelease% /Out __vc#_compile_release.log "%sVSPathName%" %sPrjFile% /Build %sConfigNameDebug% /Out __vc#_compile_debug.log Rem /project lxDbLib.csproj /projectconfig Debug ) @echo off echo. echo --------------------------------- echo [%sPrjName%]: compiling end. echo --------------------------------- echo. echo -------------------------------------- echo ------ %date% [%time%] ------ echo -------------------------------------- echo ---------- .:: -=LEXX=- ::. ---------- echo -------------------------------------- :: -------------------------------------- :: pause 



At first glance, the bulkiness of this code is compensated by the simplicity of the subsequent work in the console. All pleasant programming!

Source: https://habr.com/ru/post/215835/


All Articles