How to convert a batch script in ruby

Hi All,

I am new to ruby and currently working on a batch file which needs to
be converted into ruby.

The batch code is
: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 am trying to convert this code into ruby. with only little experience
in ruby, I am able to transform only some portion of code

def find_current_paging_fileSettingsC?
cmd=Mixlib::ShellOut.new(‘wmic pagefileset list | findstr /i /c:“c:”’)
cmd.run_command
puts cmd.stdout[0]
if cmd.exitstatus != 0
puts “NoPagingFileC setting to true”
end
end

if find_current_paging_fileSettingsC?
end

how to implement GOTO. here I would like to go to another function
FindCurrentPagingFileSettingsP.
how to handle for condition here!!!
Please suggest any other better option to do.

Thanks
Sachin

Just define the method named FindCurrentPagingFileSettingsP(), then call
it. That simple.