By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

How to execute batch file with a pathname using Javascript? (Windows XP and IE)

P: 1
Hi

I have a problem with printing a text file.

When i am inserting the data into database, created a text file with user(ex.Test_user.txt). But when i am giving Print the bill from dot matrix printer it will skipping the paper.

Then i created the batch file, in that batch file manually i mentioned the TYPE command with path of the file. Then it will print correctly.

My Application is developed in classic ASP and Java script. How can i pass the path to batch file. i want to give the server path from java script to the batch file.

Ex: serverpath/folder/test.txt.
Printer TVS RP45

Given in bat file like this:
Type \\10.10.40.11\ipoprp\VisitorPassEntry.txt > LPT1

mention in javascript:

Expand|Select|Wrap|Line Numbers
  1. MyObject = new ActiveXObject( "WScript.Shell" )  
  2. function Runbat()   
  3. {  
  4.  MyObject.Run("C:\\PRINT.bat")   
  5. }
How to pass the path to batch file
Dec 19 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.