批處理新手入門導讀[視頻教程]批處理基礎視頻教程[視頻教程]VBS基礎視頻教程
[批處理文件精品]批處理版照片整理器[批處理文件精品]純批處理備份&還原驅動在線第三方下載
返回列表 發帖

[文本處理] [已解決]批處理怎么將超長的特殊字符輸出給另一個文件

以下是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 "[email protected] tokens=*" %%e in ("%%a") do if "%%e" NEQ "" >>2.txt echo %%e
  3. )
  4. pause
復制代碼
我不需要批量,只需要逐行輸入。以上行數不能完全輸出,中間會被丟掉一部分,不知道為什么。
1

評分人數

    • CrLf: 感謝給帖子標題標注[已解決]字樣PB + 2
悲杯,沒有可用的簽名。。

代碼前后矛盾,不懂樓主的目的是生成什么樣的結果呢?

TOP

回復 2# CrLf


    1.txt只是我這里文本中的一部分,我只把問題部分傳上來。
   選是找到文本中含“菜單:”行
  而第二部則是將于“菜單:@”去掉,輸入@附號以后的內容到2.txt
  “@”相當于是一個開關,開關不同,需要輸出的目標文件也不同。
  因此代有“@”附號的后面內容將輸出到2.txt中。
現在的問題是@號后的所有內容可以輸入到2.txt中,但是不完整,中間會丟掉一部分。求指教。
悲杯,沒有可用的簽名。。

TOP

那代碼沒什么問題,不過看到 1.txt 內容中有大量的 !,估計是你開了變量延遲導致的?
在這段代碼前加一句 endlocal 或 setlocal disabledelayedexpansion 關閉變量延遲應可解決問題。

反正我的代碼和你的代碼輸出內容是完全相同的:
  1. @echo off
  2. (for /f "tokens=1* [email protected]" %%a in ('findstr /blc:" 菜單:" 1.txt') do echo %%b)>3.txt
  3. pause
復制代碼

TOP

回復 4# CrLf


    果真如此,還是版主厲害,可不解的是這是為什么呢。
悲杯,沒有可用的簽名。。

TOP

變量延遲是在解釋 %%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
復制代碼

TOP

回復 6# CrLf


    明白了,謝謝版主!!!
悲杯,沒有可用的簽名。。

TOP

我也是沒看懂題目的意思, 看到tokens=2,4還以為要取兩段,但之后輸出又只要了第一段,
里層循環 for /f "[email protected] tokens=*" 首字也不可能再出[email protected] , 根本就是原行輸出
再看原樣文呢,每句也只一個"@" 按說可能也不會有取值何處結束問題, 如果象3樓補充時說的,那 CrLf 版主 就已指明出錯的根本原因所在。
我是看到 CrLf 版主 代碼里似乎  " 菜單  處多了個空格,上來插句嘴

TOP

回復 8# yyykkkyyyy


    因為 copy 樣本到本地的時候在 txt 里看到行首有個空格,所以才在 findstr 的搜索關鍵詞中加上的~

TOP

返回列表
36选7开奖结果今天福建 光大银行股票行情 贵州快3投注技巧 北京拾赛车开奖结果 066体彩排列3藏机图 常州股票配资 吉林快三预测快三一定牛 云南快乐十分开奖结果走势图昨天 股票配资鑫诺 北京快三历史开奖 白小姐开奖查询 广西十一选五走势图一手机版 深圳风采彩票 吉林11选5任2一定牛 河南快三走势图一定牛加油卡备付金 快乐十分任五中奖概率 股权基金配资