将VC6的项目转换成VC.Net2003

将下面的代码另存为 convert.js
然后在cmd中调用,调用方法类似于: CScript convert.js e:/yourprojects/old.dsp e:/yourprojects/new.vcproj

// when running this at the command line,
// call it with CScript so you don't get UI.
// example: CScript convert.js e:/yourprojects/old.dsp e:/yourprojects/new.vcproj
// NOTE: full path required to both input and output files

// or set default script engine to the command line doing this first
// example: CScript //H:CScript

// Once you set the environment, run the .js file like a .bat file

// To have a batch file loop through all the .dsp files
// in a directory, write a batch file that looked like this
// (Windows NT 4 or Windows 2000 only)
// CScript //H:CScript //Nologo
// for /R %%i in (*.dsp) do convert.js %%i >> ./Convert.log

var vcProj = new ActiveXObject("VisualStudio.VCProjectEngine.7.1");
var objFile = new ActiveXObject("Scripting.FileSystemObject");
var objArgs = WScript.Arguments;

// check the arguments to be sure it's right
if (objArgs.Count() < 2)
{
   WScript.Echo("VC6 or 5 DSP Project File Conversion");
   WScript.Echo("Opens specified .dsp and converts to VC7.1 Format.");
   WScript.Echo("Will create project file with .vcproj extension");
   WScript.Echo("/n/tusage: <full path/project.dsp> <full path/project.vcproj>");
   WScript.Quit(1);
}

WScript.Echo("/nConverting: "+ objArgs.Item(0));
// If there is a file name of the .vcproj extension, do not convert
var vcProject = vcProj.LoadProject(objArgs.Item(0));
if (!objFile.FileExists(vcProject.ProjectFile))
{
   // specify name and location of new project file
   vcProject.ProjectFile = objArgs.Item(1);

   // call the project engine to save this off.
   // when no name is shown, it will create one with the .vcproj name
   vcProject.Save();
   WScript.Echo("New Project Name: "+vcProject.ProjectFile+"/n");
}
else
{
   WScript.Echo("ERROR!: "+vcProject.ProjectFile+" already exists!/n");
}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值