[chef] Converting batch script to chef


Chronological Thread 
  • From: Sachin Gupta < >
  • To:
  • Cc: sachin kumar < >
  • Subject: [chef] Converting batch script to chef
  • Date: Tue, 13 Jan 2015 19:45:45 +0530

Hello,

 I am trying to convert a windows batch script into chef script.  The sample  code is like below

:FindCurrentPagingFileSettingsC
    wmic pagefileset list | findstr /i /c:"c:">nul
        if not {%errorlevel%}=={0} set NoPagingFileC=true&goto :FindCurrentPagingFileSettingsP
    for /f "tokens=1-10 delims= " %%a in ('wmic pagefileset list ^| findstr /i /c:"c:"') do (
        set CurrentInitialPagingFileSizeMBC=%%d
        set CurrentMaximumPagingFileSizeMBC=%%e
        set CurrentPagingFileC=%%f
        )
        if defined CurrentPagingFileC (
            for /f "tokens=1-10 delims=\" %%a in ('echo %CurrentPagingFileC%') do set CurrentPagingFileCwmic=%%a\\%%b
            )

I would like to know whether its good to write such code as

batch "FindCurrentPagingFileSettingsC" do
code <<-EOH
##  here come the code
EOH
end 

 or first try to learn some ruby stuff and then write code in ruby. I am new to ruby .

Any help would be great.


Thanks & Regards,
Sachin Gupta




Archive powered by MHonArc 2.6.16.

§