Quantcast
Channel: Ru.Board
Viewing all articles
Browse latest Browse all 1003802

Задачи на bat-файлах 11 (2653) / Работаем из командной строки

$
0
0
bomzzz:
Alex_Piggy
еще один батник зафигачил. палесный аж жуть. вот тут уже не добавить не прибавить можно скрипт делать. впрочем можно сделать выбор системы по умолчанию
[more]@echo off
cd \masm32\
if exist \masm32\TMP\ rd /s /q \masm32\TMP\
md TMP
cd \masm32\include\
for /f "delims=" %%i in ('dir /A:D /B') do (
    pushd .\%%i
    for /f "delims=" %%a in ('dir /b *.inc') do (
        if not exist \masm32\TMP\%%~na.inc (
            if exist \masm32\include\w2k\%%~na.inc (
            echo ELSEIFDEF __W2K__
            echo include \masm32\include\w2k\%%~na.inc
            echo includelib \masm32\lib\w2k\%%~na.lib)>\masm32\TMP\%%~na.inc
            if exist \masm32\include\wxp\%%~na.inc (
            echo ELSEIFDEF __WXP__
            echo include \masm32\include\wxp\%%~na.inc
            echo includelib \masm32\lib\wxp\%%~na.lib)>>\masm32\TMP\%%~na.inc
            if exist \masm32\include\wnet\%%~na.inc (
            echo ELSEIFDEF __WNET__
            echo include \masm32\include\wnet\%%~na.inc
            echo includelib \masm32\lib\wnet\%%~na.lib)>>\masm32\TMP\%%~na.inc
            if exist \masm32\include\wlh\%%~na.inc (
            echo ELSEIFDEF __WLH__
            echo include \masm32\include\wlh\%%~na.inc
            echo includelib \masm32\lib\wlh\%%~na.lib)>>\masm32\TMP\%%~na.inc
            if exist \masm32\include\win7\%%~na.inc (
            echo ELSEIFDEF __WIN7__
            echo include \masm32\include\win7\%%~na.inc
            echo includelib \masm32\lib\win7\%%~na.lib)>>\masm32\TMP\%%~na.inc
        )
    )
    popd
)
SetLocal EnableDelayedExpansion
pushd \masm32\TMP\
for /f "delims=" %%i in ('dir /b *.inc') do (
(echo ; ----------------------------------------------------------------
echo ;        %%~ni.inc
echo ; ----------------------------------------------------------------
echo.)>\masm32\include\%%~ni.inc
for /f "tokens=1,2 delims= " %%a in (%%~ni.inc) do (
    if %%a==ELSEIFDEF (
        if "%%b"=="__WXP__" set "wxpok=OK"
        if "!first!"=="" (
            set "first==first"
            echo     IFDEF %%b>>\masm32\include\%%~ni.inc
        ) else (
            echo     %%a %%b>>\masm32\include\%%~ni.inc
        )
    ) else (
        set "last1=!last3!"
        set "last2=!last4!"
        set "last3=%%a"
        set "last4=%%b"
        echo     %%a %%b>>\masm32\include\%%~ni.inc
    )
)

if "!wxpok!"=="OK" (
(echo     ELSE
echo     include \masm32\include\wxp\%%~ni.inc
echo     includelib \masm32\lib\wxp\%%~ni.lib
echo     ENDIF)>>\masm32\include\%%~ni.inc
) else (
(echo     ELSE
echo     !last1! !last2!
echo     !last3! !last4!
echo     ENDIF)>>\masm32\include\%%~ni.inc
)
set "wxpok="
set "first="
set "last1="
set "last2="
set "last3="
set "last4="
)
popd
rd /s /q \masm32\TMP\[/more]

Viewing all articles
Browse latest Browse all 1003802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>