Subfolder is not generating the batch file

I need help troubleshooting this code. I created a temporary folder in the C drive, but for some reason the batch file isn't getting created. Can anyone provide some suggestions or insights?

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();
    }

Answer №1

Oopsie daisy, it looks like you forgot to include s.Close();

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Uniform Image Sizes in Bootstrap Carousel (With One Exception)

I am encountering a JavaScript exception related to image size. I am trying to set a fixed size for the images in my carousel, allowing them to auto adjust or resize without concern for distortion or pixelation. I have experimented with max-width and widt ...

Setting up Jest

I'm currently attempting to integrate the Jest Testing framework into my React Native project. Unfortunately, I am encountering an error message: Failed to retrieve mock metadata: /Users/me/Documents/Development/project/node_modules/global/window.js ...

Instructions for updating the Modal Value using ajax

This is the script I use to retrieve the data <script> $(document).ready(function() { $('.tmpsurat').click(function() { var id=$(this).data('id'); var url ='{{URL('/cekSuratKelengkapan')}}/'+id; ...

Specify the controller to be used dynamically in an Angular directive

I want to be able to specify the controller that a directive uses by adding an attribute to the element - in other words, dynamically: HTML <div data-mydirective data-ctrl="DynamicController"></div> Angular angular.module('app', [ ...

The NestJS error code 413 indicates that the payload size is too large for

I am currently utilizing nestjs and have encountered an issue where an endpoint only accepts files via multipart. When attempting to upload files that are less than 10MB, everything works perfectly fine. However, when trying to upload files larger than 10M ...

Regular expression: Search for a particular word following the initial appearance of a backslash

I need help with creating a regex pattern to find the word "bacon" after the first "/" in a URL. Here are some examples: Expected to return true: console.log('1 - ', myRegexFunction('www.bacondelivery.com/weekly-bacon-delivery/')); co ...

Visual Studio throwing a CS1061 compiler error

I recently added a button to my form and encountered error CS1061. I made sure to include the method as protected, but still received an error message stating that 'Cos' does not have a definition for 'button1_Click'. The compiler sugge ...

aspx.net communication via email with contact form

I'm looking to send an email to a specific email address using a contact form in asp.net. The website is currently hosted by a hosting company. Any advice would be greatly appreciated. Thank you! ...

Identifying the unique parent component of a component within Angular

One of my components, named Com1, is imported into multiple other components. Within Com1, there is a button that triggers a function when clicked. In this function, I am trying to print out the parent component of the specific instance of Com1. How can I ...

Refreshing PHP Script

I have a PHP file that contains a combination of HTML elements, JavaScript functions, and PHP scripts. I need to rerun a specific part of the PHP script repeatedly. Let's consider the following example: <html> <?php $connection = ...

Is it possible to set functions as variables within an if statement in JavaScript and then not be able to call them later?

My validation process involves a multi-function where I don't invoke a master function beforehand to check and validate inputs. Within my "SignUp Function", I have implemented a validation function as variables that are checked before passing to the r ...

Displaying information in form using ajax within the laravel framework

I am currently utilizing ajax to retrieve data from a database. While I am able to successfully retrieve the data on the backend, I am facing difficulties displaying it in the input field below. I have tried writing some code, but it seems that the JavaScr ...

Guidelines for securing login access where the "IsApproved" field must be true before authorization

During the account registration process, I initially set the default value to false for the field IsApproved. I need to create security rules that allow login only for users with IsApproved:true, and redirect those with IsApproved:false to the accessdenied ...

Why are the buttons on my HTML/JavaScript page not functioning properly?

I have been struggling with a code for a 5 image slideshow where the NEXT and PREVIOUS buttons are supposed to take me to the next and previous slides. However, when I press them, nothing happens. Can anyone provide some assistance? I need additional detai ...

pdfmake: Stabilized Vertical Column Dimensions

I'm working on a project where I need to add text to a column with a fixed height and width. So far, I've successfully implemented a fixed width, but I'm struggling with setting a fixed height for the column. Below is the code I've bee ...

Is it possible to utilize v-html with message data in Vue without any limitations on the <title> element?

Currently utilizing Vue.js 2 and my SDK is IntelliJ: I am attempting to bring HTML content into a Vue.js file. The main objective is to include the <title></title> attribute, as it seems that Vue doesn't have direct support for this feat ...

Adding a border in jQuery or Javascript to highlight empty form fields

After making the decision to dive into the world of Javascript, I've been dedicated to perfecting a script that will encase empty elements with a border right before the user submits a form. My ultimate goal is to implement live validation in the form ...

Testing the API call triggered by the submit button

In my LoginForm template, I have passed the onFinish function to the prop onFinish using Antd Form. Here is the implementation of my onFinish function: This function invokes the api method from class methods Services and AuthService. const onFinish = asyn ...

Switching between nested lists with a button: A simple guide

I have successfully created a nested list with buttons added to each parent <li> element. Here is how the list is structured: $("#pr1").append("<button id='bnt-cat13' class='buttons-filter'>expnd1</button>"); $("#pr ...

Find out whether the object is located behind another item

Is there a method to determine if elementA is "obscured" by another element, meaning it is not visible to the user? We could potentially achieve this using stacking context, but the challenge lies in identifying which elements to compare. This would requi ...