回复 1# waitfortea
把重定向放在左边试试,参考:
http://bbs.bathome.net/thread-13860-1-1.html#pid233014- @echo off
- setlocal enabledelayedexpansion
- cd /d "%~dp0"
- set /p "proxyhost=代理地址:"
- set /p "proxyport=代理端口:"
- set /p "downloadpath=下载路径:"
- set "num=0"
- cd. >a.txt
- for /f "tokens=1-2 delims==" %%a in (application.properties) do (
- if "comic.proxy.host" equ "%%a" (
- for %%i in (a.txt) do (
- if %%~zi equ 0 (
- >"%~dp0a.txt" echo,%%a=%proxyhost%
- ) else (
- >>"%~dp0a.txt" echo,%%a=%proxyhost%
- )
- )
- ) else if "comic.proxy.port" equ "%%a" (
- for %%i in (a.txt) do (
- if %%~zi equ 0 (
- >"%~dp0a.txt" echo,%%a=%proxyport%
- ) else (
- >>"%~dp0a.txt" echo,%%a=%proxyport%
- )
- )
- ) else if "comic.download.path" equ "%%a" (
- for %%i in (a.txt) do (
- if %%~zi equ 0 (
- >"%~dp0a.txt" echo,%%a=%downloadpath%
- ) else (
- >>"%~dp0a.txt" echo,%%a=%downloadpath%
- )
- )
- ) else if %%~zi equ 0 (
- >"%~dp0a.txt" echo,%%a=%%b
- ) else (
- echo,%%a
- >>"%~dp0a.txt" echo,%%a=%%b
- )
- )
- for /f %%l in (a.txt) do (
- echo,%%l
- set /a num+=1
- if !num! equ 1 (
- >application.properties echo,%%l
- ) else (
- >>application.properties echo,%%l
- )
- )
- dos2unix application.properties
- pause
复制代码
|