以批處理模式將Visual C++項目升級到Visual Studio .NET

來源:互聯網
上載者:User

可以在命令列上運行下面的 JScript 樣本,以升級一個或多個 Visual C++ 6.0 項目。

// 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.8.0");
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 VC8 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");
}

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.