inplace sed not working with netowrk share so normal pipe

This commit is contained in:
Mario Fetka 2014-02-22 11:20:02 +01:00
parent 048a8123e1
commit b3ed22e0cb
2 changed files with 16 additions and 20 deletions

View File

@ -27,27 +27,25 @@ goto :eof
:checkok
if exist "%temp%\list.txt" (del "%temp%\list.txt")
if exist "%temp%\list0.txt" (del "%temp%\list0.txt")
if exist "%temp%\list1.txt" (del "%temp%\list1.txt")
echo Uninstalling existing Visual C++ 2008 x64 Runtime Redistributables
echo (please wait as this process may take a few moments)
wmic product where "name like 'Microsoft Visual C++ 2008 Redistributable - x64%%'" get name >>"%temp%\list.txt"
for /f "skip=1 delims=" %%a in ('type "%temp%\list.txt"') do (echo "%%a")
wmic product where "name like 'Microsoft Visual C++ 2008 Redistributable - x64%%'" get name >>"%temp%\list0.txt"
for /f "skip=1 delims=" %%a in ('type "%temp%\list0.txt"') do (echo "%%a")
echo Converting ucs-2 encoded list of installed products to utf-8
%GNUPARENTDIR%\GNU\iconv.exe -f UCS-2 -t UTF-8 %temp%\list.txt > %temp%\list1.txt
%GNUPARENTDIR%\GNU\iconv.exe -f UCS-2 -t UTF-8 %temp%\list0.txt > %temp%\list1.txt
echo CleanUp some errors in the list file
%GNUPARENTDIR%\GNU\sed.exe -e "s/\s*$//g" -i %temp%\list1.txt
echo Converting back utf-8 encoded list of installed products to ucs-2
%GNUPARENTDIR%\GNU\iconv.exe -f UTF-8 -t UCS-2 %temp%\list1.txt > %temp%\list.txt
%GNUPARENTDIR%\GNU\sed.exe -e "s/\s*$//g" %temp%\list1.txt > %temp%\list0.txt
echo start uninstalling old versions of product
for /f "skip=1 delims=" %%a in ('type "%temp%\list1.txt"') do (echo "%%a")
for /f "skip=1 delims=" %%a in ('type "%temp%\list1.txt"') do (wmic product where "name like '%%a%'" call uninstall /nointeractive)
for /f "skip=1 delims=" %%a in ('type "%temp%\list0.txt"') do (echo "%%a")
for /f "skip=1 delims=" %%a in ('type "%temp%\list0.txt"') do (wmic product where "name like '%%a%'" call uninstall /nointeractive)
echo CleanUp Tempory files
del "%temp%\list.txt"
del "%temp%\list0.txt"
del "%temp%\list1.txt"
echo Install latest version of Visual C++ 2008 x64 Runtime Redistributables

View File

@ -27,27 +27,25 @@ goto :eof
:checkok
if exist "%temp%\list.txt" (del "%temp%\list.txt")
if exist "%temp%\list0.txt" (del "%temp%\list0.txt")
if exist "%temp%\list1.txt" (del "%temp%\list1.txt")
echo Uninstalling existing Visual C++ 2008 x86 Runtime Redistributables
echo (please wait as this process may take a few moments)
wmic product where "name like 'Microsoft Visual C++ 2008 Redistributable - x86%%'" get name >>"%temp%\list.txt"
for /f "skip=1 delims=" %%a in ('type "%temp%\list.txt"') do (echo "%%a")
wmic product where "name like 'Microsoft Visual C++ 2008 Redistributable - x86%%'" get name >>"%temp%\list0.txt"
for /f "skip=1 delims=" %%a in ('type "%temp%\list0.txt"') do (echo "%%a")
echo Converting ucs-2 encoded list of installed products to utf-8
%GNUPARENTDIR%\GNU\iconv.exe -f UCS-2 -t UTF-8 %temp%\list.txt > %temp%\list1.txt
%GNUPARENTDIR%\GNU\iconv.exe -f UCS-2 -t UTF-8 %temp%\list0.txt > %temp%\list1.txt
echo CleanUp some errors in the list file
%GNUPARENTDIR%\GNU\sed.exe -e "s/\s*$//g" -i %temp%\list1.txt
echo Converting back utf-8 encoded list of installed products to ucs-2
%GNUPARENTDIR%\GNU\iconv.exe -f UTF-8 -t UCS-2 %temp%\list1.txt > %temp%\list.txt
%GNUPARENTDIR%\GNU\sed.exe -e "s/\s*$//g" %temp%\list1.txt > %temp%\list0.txt
echo start uninstalling old versions of product
for /f "skip=1 delims=" %%a in ('type "%temp%\list1.txt"') do (echo "%%a")
for /f "skip=1 delims=" %%a in ('type "%temp%\list1.txt"') do (wmic product where "name like '%%a%'" call uninstall /nointeractive)
for /f "skip=1 delims=" %%a in ('type "%temp%\list0.txt"') do (echo "%%a")
for /f "skip=1 delims=" %%a in ('type "%temp%\list0.txt"') do (wmic product where "name like '%%a%'" call uninstall /nointeractive)
echo CleanUp Tempory files
del "%temp%\list.txt"
del "%temp%\list0.txt"
del "%temp%\list1.txt"
echo Install latest version of Visual C++ 2008 x86 Runtime Redistributables