0

我相信这段代码是正确的,但是我在 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();
    }
4

1 回答 1

0

糟糕,我认为您缺少 s.Close();

于 2013-06-12T21:24:45.760 回答