有一文本文件MANIFEST.MF,内容如下- Manifest-Version: 1.0
- Ant-Version: Apache Ant 1.7.0
- Created-By: 14.1-b02 (Sun Microsystems Inc.)
- Bundle-ManifestVersion: 2
- Bundle-Name: %bundleName
- Bundle-SymbolicName: com.cnex.oss.bss.handleconsignment.client; single
- ton:=true
- [color=Red]Bundle-Version: 3.3.70.build2012050612[/color]Bundle-Activator: com.cnex.oss.bss.handleconsignment.client.Activator
- Bundle-Vendor: %bundleVendor
- Bundle-Localization: plugin
- Require-Bundle: org.eclipse.ui,org.eclipse.core.runtime,com.cnex.org.a
- pache.commons.eclipse,com.cnex.org.apache.log4j.eclipse,com.cnex.org.
- hibernate.eclipse,com.cnex.org.springframework.eclipse,com.cnex.oss.c
- lient,com.cnex.oss.framework,com.cnex.oss.framework.eclipse,com.cnex.
- oss.model,org.junit4,com.cnex.org.eclipse.ui.widgets.imageviewer,com.
- cnex.oss.model.service,com.cnex.nebula.datetimer,com.cnex.oss.model.u
- cservice
- Eclipse-LazyStart: true
- Eclipse-RegisterBuddy: com.cnex.org.springframework.eclipse,com.cnex.o
- rg.apache.log4j.eclipse,com.cnex.org.apache.derby.eclipse.client,com.
- cnex.org.hibernate.eclipse,com.cnex.org.apache.commons.eclipse
- Export-Package: com.cnex.oss.bss.handleconsignment.client,com.cnex.oss
- .bss.handleconsignment.client.context.strategy,com.cnex.oss.bss.handl
- econsignment.newclient.controller,com.cnex.oss.bss.handleconsignment.
- newclient.helper,com.cnex.oss.bss.handleconsignment.newclient.ui.view
- ; uses:="org.eclipse.jface.window, com.cnex.oss.model.business.cargo
- , com.cnex.oss.client.view, org.eclipse.swt.events, org.eclipse.sw
- t.custom, com.cnex.oss.client.cooperate, com.cnex.org.eclipse.ui.wi
- dgets.imageviewer, com.cnex.oss.bss.handleconsignment.newclient.acti
- ons, org.eclipse.jface.action, org.eclipse.swt.graphics, org.eclip
- se.jface.viewers, com.cnex.nebula.datetimer, org.eclipse.swt.widget
- s, com.cnex.oss.model.resource.person"
复制代码 红色字段部分是需要替换的内容,可以确定的是Bundle-Version: 行开始时需要替换的内容,后面是文件版本号,数字不确定。如何替换该行的内容。
用如下代码进行读取内容发现- for /f "tokens=*" %%b in (MANIFEST.MF) do (
- set bb=%%b
- .............................
- echo !bb!>>MANIFEST1.MF
- )
复制代码 若是已空格开头的行写入新文件后,空格开头的行空格丢失了
还有行:
; uses:="org.eclipse.jface.window, com.cnex.oss.model.business.cargo
在用以上方式写入新文件中是也丢失了 |