字符串分割

@echo off
pushd %~dp0
set path_reg="HKEY_CURRENT_USER\Software\Kingsoft\Office\6.0\Common"
set key_reg="installRoot"
set str="    installRoot    REG_SZ    C:\Users\perftest\AppData\Local\Kingsoft\WPS Office\11.1.0.7660"
for /f "tokens=1,2,*" %%i in (%str%) do (
    echo %%i
    echo %%j
    echo %%k
)

reg query %path_reg% /v %key_reg% >nul 2>nul && goto :task
:errpath
echo 'the follow command execute error..'
echo 'reg query %path_reg% /v %key_reg%'
goto :end

:task
for /f "tokens=2,*" %%i in ('reg query %path_reg% /v %key_reg%') do (
    set path_office=%%j
)

:end
popd