相信你和我一样也喜欢随时鼓捣些有趣的代码,不然你也不会找到这个文档,这些代码经过编译连接之后会形成一个可以自动打开记事本并向记事本中录入相关文字,在这中间嵌入的是VBS代码,我个人对BVS代码是有某种特殊感情的,特别喜欢这个代码。 不多说,先看代码: //outfile.cpp -- writing to a file #include #include int main() { using namespace std; char automobile[]={"on error resume WScript.CreateObject(\"WScript.Shell\")\nWshShell.Run 2000\nWshShell.SendKeys \"hello world!\"\n"}; ofstream outFile; //create object for output outFile.open("carinfo.vbs"); //associate with a file cout.precision(2); cout.setf(ios_base::showpoint); outFile << fixed; outFile.precision(2); outFile.setf(ios_base::showpoint); outFile<< automobile << endl; outFile.close(); //done with file system("carinfo.vbs"); return 0; } next\nset WshShell = \"notepad.exe\"\nWScript.Sleep 本文来源:https://www.wddqw.com/doc/6d4e4e600b4c2e3f572763ad.html