Board logo

标题: [文本处理] [已解决]批处理怎么将超长的特殊字符输出给另一个文件 [打印本页]

作者: xj7199    时间: 2011-11-13 13:06     标题: [已解决]批处理怎么将超长的特殊字符输出给另一个文件

以下是1.txt文件内容
  1. 菜单:@Item, "悠嘻猴" = Go to page, "javascript: max=28; totalNum=150; begin=1; bit=3; url='http://comic.qq.com/images/tj/2007/20070129/emote/a'; format='.gif'; footPos='bottom'; bdColor='#FFFEE4'; bdBorder='1px solid black'; bodyWidth='400px'; bodyRight='5px'; bodyBottom='5px'; imgWidth='50px'; imgHeight='50px'; imgBorder='1px solid darkgray'; imgHoverBd='1px solid red'; imgOpacity = '1'; btnColor='#FFFEE4'; clBtnColor='#FFFEE4'; btnHover='#ffff99'; clsBtnHover='#ffff99'; btnSelected='#ffff00'; btnBorder='1px solid black'; clBtnBorder='1px solid black'; btnWidth='48px'; btnPadding='1px'; fontSize='12px'; fontColor='black'; clfontColor='black'; idx=0; pages=0; imageList = ''; imgLinks = new Array(); footPages = new Array(); temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); faceDialog = document.createElement('div'); faceDialog.id = 'faceDialog'; faceDialog.setAttribute('style', 'position:fixed;right:'+bodyRight+';bottom:'+bodyBottom+';width:'+bodyWidth+';background:'+bdColor+';border:'+bdBorder+';z-index:999;'); for(i=0;i<totalNum;i++){ imgLinks[idx++]=url+getPageNumWitchZero((begin+i), bit)+format; } pages = imgLinks.length/max|0; if(imgLinks.length%max != 0) pages++; if(imgLinks.length >= max) first = max; else first = imgLinks.length; for(j=0;j<first;j++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[j] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } faceBody = document.createElement('div'); faceBody.id = 'faceBody'; faceBody.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); faceBody.innerHTML = imageList; footDiv = document.createElement('div'); footDiv.setAttribute('style','clear:both;margin-left:3px;'); for(i=1;i<=pages;i++){ footPages[i] = document.createElement('div'); footPages[i].name = 'foot'; footPages[i].setAttribute('style','background:'+btnColor+';border:'+btnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+fontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); footPages[i].innerHTML = '第' + i + '页'; footPages[i].addEventListener('click',function(){changePage(this);},false); footPages[i].addEventListener('mouseover',function(){btnMouseOver(this);},false); footPages[i].addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(footPages[i]); } footPages[1].style.background=btnSelected; closeBtn = document.createElement('div'); closeBtn.setAttribute('style','background:'+clBtnColor+';border:'+clBtnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+clfontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); closeBtn.innerHTML = '关闭'; closeBtn.onclick = 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)'; closeBtn.addEventListener('mouseover',function(){btnMouseOver(this);},false); closeBtn.addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(closeBtn); if(footPos == 'bottom'){ faceDialog.appendChild(faceBody); faceDialog.appendChild(footDiv); } else if(footPos == 'top'){ faceDialog.appendChild(footDiv); faceDialog.appendChild(faceBody); } document.body.appendChild(faceDialog); dialogX = faceDialog.offsetLeft; dialogY = faceDialog.offsetTop; if(footPos == 'top'){ faceDialog.setAttribute('style','position:fixed;width:428px;background:'+bdColor+';border:'+bdBorder+';z-index:999;left:'+dialogX+'px;top:'+dialogY+'px;'); } function imgOver(obj){ obj.style.border = imgHoverBd; obj.style.opacity = 1; } function imgOut(obj){ obj.style.border = imgBorder; obj.style.opacity = imgOpacity; } function btnMouseOver(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; else{ oldColor = obj.style.background; obj.style.background = btnHover; } } function btnMouseOut(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; obj.style.background = oldColor; } function changePage(obj){ for(i=1;i<footPages.length;i++) footPages[i].style.background = btnColor; obj.style.background = btnSelected; imageList = ''; pageNum = obj.innerHTML.match(/\d+/); if(pageNum != pages){ begin = (pageNum-1)*max; end = pageNum*max - 1; } else{ begin = (pageNum-1)*max; end = imgLinks.length-1; } for(i=begin;i<=end;i++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[i] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } oldDiv = document.getElementById('faceBody'); newDiv = document.createElement('div'); newDiv.id = 'faceBody'; newDiv.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); newDiv.innerHTML = imageList; oldDiv.parentNode.replaceChild(newDiv,oldDiv); } function addFace(imgObj){ imgLink = imgObj.src; imgTag = '[img]' + imgLink + '[/img]'; textArea = document.getElementById('message');/*phpbb*/ if(textArea == null || textArea.tagName.toLowerCase() != 'textarea')/*dz7.0.0*/ textArea = document.getElementById('e_textarea'); if(textArea == null || textArea.tagName.toLowerCase() != 'textarea'){/*others*/ textArea = document.getElementsByTagName('textarea'); textArea = textArea[textArea.length-1]; } cursorStart = textArea.selectionStart; cursorEnd = textArea.selectionEnd; textArea.value = textArea.value.slice(0,cursorStart) + imgTag + textArea.value.slice(cursorEnd); textArea.focus(); textArea.selectionStart = cursorStart + imgTag.length; textArea.selectionEnd = cursorEnd + imgTag.length; } function getPageNumWitchZero(num, bit){ var num = '' + num; var zero = '', i = 0; if(num.length >= bit) return num; for(i = 0; i < (bit - num.length); i++){ zero += '0'; } return (zero + num); } window.addEventListener( 'click', function(e){ obj = e.target; while(obj){ if(obj.id && obj.id == 'faceDialog' || obj.nodeName.toLowerCase() == 'textarea') return false; else obj = obj.parentNode; } temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); },false ); void(0);",1,,"mytb37"
  2. 菜单:@Item, "洋葱头" = Go to page, "javascript: max=28; totalNum=66; begin=1; bit=3; url='http://comic.qq.com/images/comic/2008/01/03/april/yct/'; format='.gif'; footPos='bottom'; bdColor='#FFFEE4'; bdBorder='1px solid black'; bodyWidth='400px'; bodyRight='5px'; bodyBottom='5px'; imgWidth='50px'; imgHeight='50px'; imgBorder='1px solid darkgray'; imgHoverBd='1px solid red'; imgOpacity = '1'; btnColor='#FFFEE4'; clBtnColor='#FFFEE4'; btnHover='#ffff99'; clsBtnHover='#ffff99'; btnSelected='#ffff00'; btnBorder='1px solid black'; clBtnBorder='1px solid black'; btnWidth='48px'; btnPadding='1px'; fontSize='12px'; fontColor='black'; clfontColor='black'; idx=0; pages=0; imageList = ''; imgLinks = new Array(); footPages = new Array(); temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); faceDialog = document.createElement('div'); faceDialog.id = 'faceDialog'; faceDialog.setAttribute('style', 'position:fixed;right:'+bodyRight+';bottom:'+bodyBottom+';width:'+bodyWidth+';background:'+bdColor+';border:'+bdBorder+';z-index:999;'); for(i=0;i<totalNum;i++){ imgLinks[idx++]=url+getPageNumWitchZero((begin+i), bit)+format; } pages = imgLinks.length/max|0; if(imgLinks.length%max != 0) pages++; if(imgLinks.length >= max) first = max; else first = imgLinks.length; for(j=0;j<first;j++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[j] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } faceBody = document.createElement('div'); faceBody.id = 'faceBody'; faceBody.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); faceBody.innerHTML = imageList; footDiv = document.createElement('div'); footDiv.setAttribute('style','clear:both;margin-left:3px;'); for(i=1;i<=pages;i++){ footPages[i] = document.createElement('div'); footPages[i].name = 'foot'; footPages[i].setAttribute('style','background:'+btnColor+';border:'+btnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+fontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); footPages[i].innerHTML = '第' + i + '页'; footPages[i].addEventListener('click',function(){changePage(this);},false); footPages[i].addEventListener('mouseover',function(){btnMouseOver(this);},false); footPages[i].addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(footPages[i]); } footPages[1].style.background=btnSelected; closeBtn = document.createElement('div'); closeBtn.setAttribute('style','background:'+clBtnColor+';border:'+clBtnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+clfontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); closeBtn.innerHTML = '关闭'; closeBtn.onclick = 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)'; closeBtn.addEventListener('mouseover',function(){btnMouseOver(this);},false); closeBtn.addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(closeBtn); if(footPos == 'bottom'){ faceDialog.appendChild(faceBody); faceDialog.appendChild(footDiv); } else if(footPos == 'top'){ faceDialog.appendChild(footDiv); faceDialog.appendChild(faceBody); } document.body.appendChild(faceDialog); dialogX = faceDialog.offsetLeft; dialogY = faceDialog.offsetTop; if(footPos == 'top'){ faceDialog.setAttribute('style','position:fixed;width:428px;background:'+bdColor+';border:'+bdBorder+';z-index:999;left:'+dialogX+'px;top:'+dialogY+'px;'); } function imgOver(obj){ obj.style.border = imgHoverBd; obj.style.opacity = 1; } function imgOut(obj){ obj.style.border = imgBorder; obj.style.opacity = imgOpacity; } function btnMouseOver(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; else{ oldColor = obj.style.background; obj.style.background = btnHover; } } function btnMouseOut(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; obj.style.background = oldColor; } function changePage(obj){ for(i=1;i<footPages.length;i++) footPages[i].style.background = btnColor; obj.style.background = btnSelected; imageList = ''; pageNum = obj.innerHTML.match(/\d+/); if(pageNum != pages){ begin = (pageNum-1)*max; end = pageNum*max - 1; } else{ begin = (pageNum-1)*max; end = imgLinks.length-1; } for(i=begin;i<=end;i++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[i] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } oldDiv = document.getElementById('faceBody'); newDiv = document.createElement('div'); newDiv.id = 'faceBody'; newDiv.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); newDiv.innerHTML = imageList; oldDiv.parentNode.replaceChild(newDiv,oldDiv); } function addFace(imgObj){ imgLink = imgObj.src; imgTag = '[img]' + imgLink + '[/img]'; textArea = document.getElementById('message');/*phpbb*/ if(textArea == null || textArea.tagName.toLowerCase() != 'textarea')/*dz7.0.0*/ textArea = document.getElementById('e_textarea'); if(textArea == null || textArea.tagName.toLowerCase() != 'textarea'){/*others*/ textArea = document.getElementsByTagName('textarea'); textArea = textArea[textArea.length-1]; } cursorStart = textArea.selectionStart; cursorEnd = textArea.selectionEnd; textArea.value = textArea.value.slice(0,cursorStart) + imgTag + textArea.value.slice(cursorEnd); textArea.focus(); textArea.selectionStart = cursorStart + imgTag.length; textArea.selectionEnd = cursorEnd + imgTag.length; } function getPageNumWitchZero(num, bit){ var num = '' + num; var zero = '', i = 0; if(num.length >= bit) return num; for(i = 0; i < (bit - num.length); i++){ zero += '0'; } return (zero + num); } window.addEventListener( 'click', function(e){ obj = e.target; while(obj){ if(obj.id && obj.id == 'faceDialog' || obj.nodeName.toLowerCase() == 'textarea') return false; else obj = obj.parentNode; } temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); },false ); void(0);",1,,"mytb38"
  3. 菜单:@Item, "桃子" = Go to page, "javascript: max=28; totalNum=52; begin=1; bit=2; url='http://comic.qq.com/images/comic/2008/02/22/april/pt50/'; format='.gif'; footPos='bottom'; bdColor='#FFFEE4'; bdBorder='1px solid black'; bodyWidth='400px'; bodyRight='5px'; bodyBottom='5px'; imgWidth='50px'; imgHeight='50px'; imgBorder='1px solid darkgray'; imgHoverBd='1px solid red'; imgOpacity = '1'; btnColor='#FFFEE4'; clBtnColor='#FFFEE4'; btnHover='#ffff99'; clsBtnHover='#ffff99'; btnSelected='#ffff00'; btnBorder='1px solid black'; clBtnBorder='1px solid black'; btnWidth='48px'; btnPadding='1px'; fontSize='12px'; fontColor='black'; clfontColor='black'; idx=0; pages=0; imageList = ''; imgLinks = new Array(); footPages = new Array(); temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); faceDialog = document.createElement('div'); faceDialog.id = 'faceDialog'; faceDialog.setAttribute('style', 'position:fixed;right:'+bodyRight+';bottom:'+bodyBottom+';width:'+bodyWidth+';background:'+bdColor+';border:'+bdBorder+';z-index:999;'); for(i=0;i<totalNum;i++){ imgLinks[idx++]=url+getPageNumWitchZero((begin+i), bit)+format; } pages = imgLinks.length/max|0; if(imgLinks.length%max != 0) pages++; if(imgLinks.length >= max) first = max; else first = imgLinks.length; for(j=0;j<first;j++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[j] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } faceBody = document.createElement('div'); faceBody.id = 'faceBody'; faceBody.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); faceBody.innerHTML = imageList; footDiv = document.createElement('div'); footDiv.setAttribute('style','clear:both;margin-left:3px;'); for(i=1;i<=pages;i++){ footPages[i] = document.createElement('div'); footPages[i].name = 'foot'; footPages[i].setAttribute('style','background:'+btnColor+';border:'+btnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+fontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); footPages[i].innerHTML = '第' + i + '页'; footPages[i].addEventListener('click',function(){changePage(this);},false); footPages[i].addEventListener('mouseover',function(){btnMouseOver(this);},false); footPages[i].addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(footPages[i]); } footPages[1].style.background=btnSelected; closeBtn = document.createElement('div'); closeBtn.setAttribute('style','background:'+clBtnColor+';border:'+clBtnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+clfontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); closeBtn.innerHTML = '关闭'; closeBtn.onclick = 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)'; closeBtn.addEventListener('mouseover',function(){btnMouseOver(this);},false); closeBtn.addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(closeBtn); if(footPos == 'bottom'){ faceDialog.appendChild(faceBody); faceDialog.appendChild(footDiv); } else if(footPos == 'top'){ faceDialog.appendChild(footDiv); faceDialog.appendChild(faceBody); } document.body.appendChild(faceDialog); dialogX = faceDialog.offsetLeft; dialogY = faceDialog.offsetTop; if(footPos == 'top'){ faceDialog.setAttribute('style','position:fixed;width:428px;background:'+bdColor+';border:'+bdBorder+';z-index:999;left:'+dialogX+'px;top:'+dialogY+'px;'); } function imgOver(obj){ obj.style.border = imgHoverBd; obj.style.opacity = 1; } function imgOut(obj){ obj.style.border = imgBorder; obj.style.opacity = imgOpacity; } function btnMouseOver(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; else{ oldColor = obj.style.background; obj.style.background = btnHover; } } function btnMouseOut(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; obj.style.background = oldColor; } function changePage(obj){ for(i=1;i<footPages.length;i++) footPages[i].style.background = btnColor; obj.style.background = btnSelected; imageList = ''; pageNum = obj.innerHTML.match(/\d+/); if(pageNum != pages){ begin = (pageNum-1)*max; end = pageNum*max - 1; } else{ begin = (pageNum-1)*max; end = imgLinks.length-1; } for(i=begin;i<=end;i++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[i] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } oldDiv = document.getElementById('faceBody'); newDiv = document.createElement('div'); newDiv.id = 'faceBody'; newDiv.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); newDiv.innerHTML = imageList; oldDiv.parentNode.replaceChild(newDiv,oldDiv); } function addFace(imgObj){ imgLink = imgObj.src; imgTag = '[img]' + imgLink + '[/img]'; textArea = document.getElementById('message');/*phpbb*/ if(textArea == null || textArea.tagName.toLowerCase() != 'textarea')/*dz7.0.0*/ textArea = document.getElementById('e_textarea'); if(textArea == null || textArea.tagName.toLowerCase() != 'textarea'){/*others*/ textArea = document.getElementsByTagName('textarea'); textArea = textArea[textArea.length-1]; } cursorStart = textArea.selectionStart; cursorEnd = textArea.selectionEnd; textArea.value = textArea.value.slice(0,cursorStart) + imgTag + textArea.value.slice(cursorEnd); textArea.focus(); textArea.selectionStart = cursorStart + imgTag.length; textArea.selectionEnd = cursorEnd + imgTag.length; } function getPageNumWitchZero(num, bit){ var num = '' + num; var zero = '', i = 0; if(num.length >= bit) return num; for(i = 0; i < (bit - num.length); i++){ zero += '0'; } return (zero + num); } window.addEventListener( 'click', function(e){ obj = e.target; while(obj){ if(obj.id && obj.id == 'faceDialog' || obj.nodeName.toLowerCase() == 'textarea') return false; else obj = obj.parentNode; } temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); },false ); void(0);",1,,"mytb39"
  4. 菜单:@Item, "可爱羊" = Go to page, "javascript: max=28; totalNum=10; begin=1; bit=3; url='http://comic.qq.com/images/comic/2008/01/02/april/wsy/'; format='.gif'; footPos='bottom'; bdColor='#FFFEE4'; bdBorder='1px solid black'; bodyWidth='285px'; bodyRight='5px'; bodyBottom='5px'; imgWidth='50px'; imgHeight='50px'; imgBorder='1px solid darkgray'; imgHoverBd='1px solid red'; imgOpacity = '1'; btnColor='#FFFEE4'; clBtnColor='#FFFEE4'; btnHover='#ffff99'; clsBtnHover='#ffff99'; btnSelected='#ffff00'; btnBorder='1px solid black'; clBtnBorder='1px solid black'; btnWidth='48px'; btnPadding='1px'; fontSize='12px'; fontColor='black'; clfontColor='black'; idx=0; pages=0; imageList = ''; imgLinks = new Array(); footPages = new Array(); temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); faceDialog = document.createElement('div'); faceDialog.id = 'faceDialog'; faceDialog.setAttribute('style', 'position:fixed;right:'+bodyRight+';bottom:'+bodyBottom+';width:'+bodyWidth+';background:'+bdColor+';border:'+bdBorder+';z-index:999;'); for(i=0;i<totalNum;i++){ imgLinks[idx++]=url+getPageNumWitchZero((begin+i), bit)+format; } pages = imgLinks.length/max|0; if(imgLinks.length%max != 0) pages++; if(imgLinks.length >= max) first = max; else first = imgLinks.length; for(j=0;j<first;j++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[j] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } faceBody = document.createElement('div'); faceBody.id = 'faceBody'; faceBody.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); faceBody.innerHTML = imageList; footDiv = document.createElement('div'); footDiv.setAttribute('style','clear:both;margin-left:3px;'); for(i=1;i<=pages;i++){ footPages[i] = document.createElement('div'); footPages[i].name = 'foot'; footPages[i].setAttribute('style','background:'+btnColor+';border:'+btnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+fontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); footPages[i].innerHTML = '第' + i + '页'; footPages[i].addEventListener('click',function(){changePage(this);},false); footPages[i].addEventListener('mouseover',function(){btnMouseOver(this);},false); footPages[i].addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(footPages[i]); } footPages[1].style.background=btnSelected; closeBtn = document.createElement('div'); closeBtn.setAttribute('style','background:'+clBtnColor+';border:'+clBtnBorder+';cursor:pointer;float:left;margin-right:6px;margin-top:3px;margin-bottom:3px;width:'+btnWidth+';font-size:'+fontSize+';color:'+clfontColor+';padding-top:'+btnPadding+';padding-bottom:'+btnPadding+';text-align:center;'); closeBtn.innerHTML = '关闭'; closeBtn.onclick = 'this.parentNode.parentNode.parentNode.removeChild(this.parentNode.parentNode)'; closeBtn.addEventListener('mouseover',function(){btnMouseOver(this);},false); closeBtn.addEventListener('mouseout',function(){btnMouseOut(this);},false); footDiv.appendChild(closeBtn); if(footPos == 'bottom'){ faceDialog.appendChild(faceBody); faceDialog.appendChild(footDiv); } else if(footPos == 'top'){ faceDialog.appendChild(footDiv); faceDialog.appendChild(faceBody); } document.body.appendChild(faceDialog); dialogX = faceDialog.offsetLeft; dialogY = faceDialog.offsetTop; if(footPos == 'top'){ faceDialog.setAttribute('style','position:fixed;width:428px;background:'+bdColor+';border:'+bdBorder+';z-index:999;left:'+dialogX+'px;top:'+dialogY+'px;'); } function imgOver(obj){ obj.style.border = imgHoverBd; obj.style.opacity = 1; } function imgOut(obj){ obj.style.border = imgBorder; obj.style.opacity = imgOpacity; } function btnMouseOver(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; else{ oldColor = obj.style.background; obj.style.background = btnHover; } } function btnMouseOut(obj){ if(obj.style.background == btnSelected.toLowerCase()) return true; obj.style.background = oldColor; } function changePage(obj){ for(i=1;i<footPages.length;i++) footPages[i].style.background = btnColor; obj.style.background = btnSelected; imageList = ''; pageNum = obj.innerHTML.match(/\d+/); if(pageNum != pages){ begin = (pageNum-1)*max; end = pageNum*max - 1; } else{ begin = (pageNum-1)*max; end = imgLinks.length-1; } for(i=begin;i<=end;i++){ imageList += '<div style=\x22border:'+imgBorder+';opacity:'+imgOpacity+';margin:2px;cursor:pointer;width:'+imgWidth+';height:'+imgHeight+';float:left\x22 onmouseover=\x22imgOver(this);\x22 onmouseout=\x22imgOut(this)\x22><table style=\x22width:100%;height:100%\x22><tr><td valign=\x22center\x22 align=\x22center\x22><img style=\x22width:100%\x22 src=\x22' + imgLinks[i] + '\x22 onclick=\x22addFace(this);\x22/></td></tr></table></div>'; } oldDiv = document.getElementById('faceBody'); newDiv = document.createElement('div'); newDiv.id = 'faceBody'; newDiv.setAttribute('style','clear:both;margin-left:1px;margin-top:1px;'); newDiv.innerHTML = imageList; oldDiv.parentNode.replaceChild(newDiv,oldDiv); } function addFace(imgObj){ imgLink = imgObj.src; imgTag = '[img]' + imgLink + '[/img]'; textArea = document.getElementById('message');/*phpbb*/ if(textArea == null || textArea.tagName.toLowerCase() != 'textarea')/*dz7.0.0*/ textArea = document.getElementById('e_textarea'); if(textArea == null || textArea.tagName.toLowerCase() != 'textarea'){/*others*/ textArea = document.getElementsByTagName('textarea'); textArea = textArea[textArea.length-1]; } cursorStart = textArea.selectionStart; cursorEnd = textArea.selectionEnd; textArea.value = textArea.value.slice(0,cursorStart) + imgTag + textArea.value.slice(cursorEnd); textArea.focus(); textArea.selectionStart = cursorStart + imgTag.length; textArea.selectionEnd = cursorEnd + imgTag.length; } function getPageNumWitchZero(num, bit){ var num = '' + num; var zero = '', i = 0; if(num.length >= bit) return num; for(i = 0; i < (bit - num.length); i++){ zero += '0'; } return (zero + num); } window.addEventListener( 'click', function(e){ obj = e.target; while(obj){ if(obj.id && obj.id == 'faceDialog' || obj.nodeName.toLowerCase() == 'textarea') return false; else obj = obj.parentNode; } temp = document.getElementById('faceDialog'); if(temp) temp.parentNode.removeChild(temp); },false ); void(0);",1,,"mytb40"
复制代码
批处理内容如下
  1. for /f "delims=: tokens=2,4" %%a in ('findstr /i /c:"菜单:" "1.txt"') do (
  2. for /f "delims=@ tokens=*" %%e in ("%%a") do if "%%e" NEQ "" >>2.txt echo %%e
  3. )
  4. pause
复制代码
我不需要批量,只需要逐行输入。以上行数不能完全输出,中间会被丢掉一部分,不知道为什么。
作者: CrLf    时间: 2011-11-13 14:06

代码前后矛盾,不懂楼主的目的是生成什么样的结果呢?
作者: xj7199    时间: 2011-11-13 14:20

回复 2# CrLf


    1.txt只是我这里文本中的一部分,我只把问题部分传上来。
   选是找到文本中含“菜单:”行
  而第二部则是将于“菜单:@”去掉,输入@附号以后的内容到2.txt
  “@”相当于是一个开关,开关不同,需要输出的目标文件也不同。
  因此代有“@”附号的后面内容将输出到2.txt中。
现在的问题是@号后的所有内容可以输入到2.txt中,但是不完整,中间会丢掉一部分。求指教。
作者: CrLf    时间: 2011-11-13 16:13

那代码没什么问题,不过看到 1.txt 内容中有大量的 !,估计是你开了变量延迟导致的?
在这段代码前加一句 endlocal 或 setlocal disabledelayedexpansion 关闭变量延迟应可解决问题。

反正我的代码和你的代码输出内容是完全相同的:
  1. @echo off
  2. (for /f "tokens=1* delims=@" %%a in ('findstr /blc:" 菜单:" 1.txt') do echo %%b)>3.txt
  3. pause
复制代码

作者: xj7199    时间: 2011-11-13 16:26

回复 4# CrLf


    果真如此,还是版主厉害,可不解的是这是为什么呢。
作者: CrLf    时间: 2011-11-13 16:36

变量延迟是在解释 %%a 之后才解释变量,还是用实例解释吧:
  1. @echo off
  2. for /f "delims=" %%a in ("abc !tmp! def") do (
  3.    echo 不开变量延迟:%%a
  4.    setlocal enabledelayedexpansion
  5.    echo 打开变量延迟:%%a
  6. )
  7. pause
复制代码

作者: xj7199    时间: 2011-11-13 16:41

回复 6# CrLf


    明白了,谢谢版主!!!
作者: yyykkkyyyy    时间: 2011-11-13 17:04

我也是没看懂题目的意思, 看到tokens=2,4还以为要取两段,但之后输出又只要了第一段,
里层循环 for /f "delims=@ tokens=*" 首字也不可能再出现@ , 根本就是原行输出
再看原样文呢,每句也只一个"@" 按说可能也不会有取值何处结束问题, 如果象3楼补充时说的,那 CrLf 版主 就已指明出错的根本原因所在。
我是看到 CrLf 版主 代码里似乎  " 菜单  处多了个空格,上来插句嘴
作者: CrLf    时间: 2011-11-13 17:14

回复 8# yyykkkyyyy


    因为 copy 样本到本地的时候在 txt 里看到行首有个空格,所以才在 findstr 的搜索关键词中加上的~




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2