Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How Do You Call Javascript In Batch File..?

0
Posted

How Do You Call Javascript In Batch File..?

0

You should just be able to call the .js file from the .bat. The script must be in a .js file and not a .jsp file cause the latter is for use on the web and the former is used purely for scripting, .js files used in webpages never usually contain any web data its usually purely scripts. The Windows Script Host requires you use js files it won’t accept jsp Example: Create a file called example.bat and make its contents: @echo off echo calling js file myJavaScript.js pause Then make a file called myJavaScript.js and make its contents: // Instantiate a File System ActiveX Object: var fso = new ActiveXObject(“Scripting.FileSystemObjec… // Invoke the method: var a = fso.CreateTextFile(“d:\\testfile.txt”, true); // Do something with it: a.WriteLine(“This is a test.”); // Close the connection: a.Close(); Save both in the same folder and then run the bat it should work fine, provided D: drive exists, that it is not the system drive because you can’t put files in the root of the system drive [no

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123