Windows XP 环境下在安装了VC6.0使用bat批处理的形式命令行编译链接生成exe文件测试练习操作步骤 1.正常安装好VC6.0环境可以正常编译执行生成exe文件 2.配置系统环境变量PATH 3.在系统环境变量位置添加LIB名称并添加VC6.0对应LIB文件路径 4.在选题环境变量位置添加INCLUDE名称并添加VC6.0对应INCLUDE路径 5.下面是详细的配置信息,仅供参考: LIB: C:\Program Files\Microsoft Visual Studio\VC98\LIB;C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB INCLUDE C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE;C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE;C:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE\;C:\Program Files\Microsoft Visual Studio\VC98\ATL\SRC PATH %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft Visual Studio\VC98\Bin\;C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\;C:\Program Files\Microsoft Visual Studio\VC98\Lib\;C:\Program Files\Microsoft Visual Studio\VC98\Include\;C:\Program Files\Microsoft Visual Studio\VC98\ATL\SRC;C:\Program Files\Microsoft Visual Studio\VC98\ATL\Include\;;C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\;C:\Program Files\Microsoft Visual Studio\VC98\MFC\LIB 关于查找VC6.0的LIB和INCLUDE文件路径可以在编译器的Tools-->Options-->Directories下面查找对应的LIB和INCLUDE
对应执行的bat简单测试代码
@echo off cd C:\cntflx\commandlx del *.obj del *.asm del *.exe cl /c /W3 /WX C:\cntflx\commandlx\pelx.cpp /FAs C:\cntflx\commandlx\pelx.asm link pelx.obj pelx.exe pause
上述操作之前最好先测试正常命令行情况下是否可以正常执行cl.exe和link.exe命令,如果不能根据报错将缺少的dll文件复制到cl.exe和link.exe所在的目录即可