Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9282511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:23:41+00:00 2026-06-18T18:23:41+00:00

I have created HTA file which has userform to collect data from the user.

  • 0

I have created HTA file which has userform to collect data from the user.
I am calling this HTA file from batch file.

After reading user inputs, i want input values to be passed to batch file from HTA.
Is is possible to achieve?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T18:23:43+00:00Added an answer on June 18, 2026 at 6:23 pm

    Yes, you can have the HTA file return the values to the batch file, but it cannot do it directly. You have to use Javascript to create a text file with the user provided values, then your batch file can process the values. Here’s a site with several methods listed to read and write text files:

    http://www.c-point.com/JavaScript/articles/file_access_with_JavaScript.htm

    Using one of these, I created a very simple example to demonstrate how this is done:

    SimpleForm.hta

    <HTML> 
      <HEAD> 
        <SCRIPT language="JavaScript">
          function WriteFile() {
            var fso  = new ActiveXObject("Scripting.FileSystemObject"); 
            var fh = fso.CreateTextFile("c:\\Output.txt", true); 
            fh.WriteLine(myForm.FN.value + '~' + myForm.LN.value);
            fh.Close(); 
          }
        </SCRIPT>
      </HEAD>
      <BODY>
        <FORM name="myForm">
          <P>First Name: <INPUT name="FN" type="text"></P>
          <P>Last Name: <INPUT name="LN" type="text"></P>
          <P><INPUT type="button" value="Save Values" onclick="WriteFile();"></P>
        </FORM>
        <P>After you click 'save', close the window.</P>
      </BODY>
    </HTML>
    

    Now the batch file:

    @echo off
    
    start /wait SimpleForm.hta
    for /f "tokens=1,2 delims=~" %%i in (C:\Output.txt) do (
      set FirstName=%%i
      set LastName=%%j
    )
    
    del C:\Output.txt
    
    echo The user entered %FirstName% %LastName% for their name.
    

    You will need to deal with the complexities of the user typing in the delimiter character (a tilde in my example) into one of the text fields and throwing off parameter parsing of the for statement. You could use an obscure character that the user won’t type for instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an xml file like below <Engagements> <User name =jjjj> <Engagement id=1111/>
I have created a windows service which is set to start automatically. This service
i have created a running process which listens for input: listen = Popen([home/user/listen], stdout=PIPE,
I have a form which has a single textbox that sends some data to
I have created 3 classes as following Ext.mine.TextParent - Inherting from Textfield Ext.mine.child.TextChildA -
I have created an EDMX in visual studio 2010 SP1. It has been built
I have a pointer int *h_a which references a large number N of data
I have created a c++ application to read content of a file into an
I have created a simple multicast player using actinscript 3 which works fine and
Have created a ATL COM project through which I am inserting Menu Items to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.