我相信这段代码是正确的,但是我在c:\中创建了一个临时文件夹,并且由于某种原因没有创建批处理文件..有没有人有建议?
var sText, s;
var fso = new ActiveXObject("Scripting.FileSystemObject");
if (!fso.FileExists("C:\\temp\\COO_BTO_Test.bat")) {
s = fso.CreateTextFile("C:\\temp\\COO_BTO_Test.bat", true);
sText = "@echo off";
s.WriteLine(sText);
sText = ":Lbl";
s.WriteLine(sText);
sText = "ECHO \"^XA^MD0^PRB^JVY^LL1760^LH%XL%,%YL%^FS \">> COO.TXT";
s.WriteLine(sText);
sText = "ECHO \"^FO66,08^BY2,2.0,32^BCN,N,N,N^SN%Sno0%,1,Y^FS \">> COO.TXT";
s.WriteLine(sText);
sText = "ECHO \"^FO66,48^AF,8,8^SN%Sno0%,1,Y^FS \">> COO.TXT";
s.WriteLine(sText);
sText = ":END";
s.WriteLine(sText);
sText = "ECHO \"^PQ1 \">> COO.TXT";
s.WriteLine(sText);
sText = "ECHO \"^XZ \">> COO.TXT";
s.WriteLine(sText);
sText = "REM MODE COM1 9600"
s.WriteLine(sText);
sText = "REM TYPE COO.TXT > COM1"
s.WriteLine(sText);
sText = "TYPE COO.TXT > LPT1"
s.WriteLine(sText);
s.Close();
}
答案 0 :(得分:0)
哎呀,我觉得你错过了一个s.Close();