Batch file – HTA and BATCH HYBRID, transfer variables from part

I am trying to write a batch hta hybrid script that allows me to pass variables from the batch part of the script to the hta part, so that I can generate things like computer models, etc.

This is what I have so far – batch:


As you can see, I try to use% model% as a parameter, and I tried to use arg1 in my VBScript part to try to use the variable-but it didn’t work.

So in my hta part, this is my vbscript:< /p>

This is just opening an empty box.

I have been searching online for a while trying to find a way to do this and I can’t figure it out. The previous solution to this problem was basically creating a batch Script, create a new file, i.e. hta& batch mixing, but I want to avoid this simple.

Any help will be greatly appreciated

You can use the Environment object of the Wscript.Shell COM object to access the environment variables in the HTA runtime. You can use Scripting.FileSys The GetStandardStream method of temObject passes data from HTA back to the Batch thread on stdout. Here is a demonstration of both:


For its value, you can also disguise it through kludging. The wsf file extension uses cscript to access VBScript in a mixed format. In addition to eliminating the short flicker of the HTA window that appears and disappears , The advantage is that you can pass script parameters directly without accessing the environment (“process”) scope.




But hybrid Batch + JScript is easier. Use .wsf The method can also use both VBScript and JScript code as multiple jobs.

I am trying to write a batch hta hybrid script, which allows me to transfer variables from the batch of the script Part is passed to the hta part so that I can generate things like computer model etc.

This is what I have so far – batch:

< pre>

As you can see, I tried to use %model% as a parameter, and I tried to use it in my VBScript part arg1 to try to use the variable-but it doesn’t work.

So in my hta section, this is my vbscript:

This is just opening an empty box.

I Been looking for a while online trying to find a way to do this and I can’t figure it out. The previous solution to this problem was basically creating a batch script, creating a new file, i.e. hta & batch mixing, But I want to avoid this simple.

Any help will be greatly appreciated

You can use the Environment object of the Wscript.Shell COM object to access the HTA Environment variables in runtime. You can use the GetStandardStream method of Scripting.FileSystemObject to pass data from HTA back to the Batch thread on stdout. The following is a demonstration of both:

< pre>

For its value, you also You can use kludging to disguise the .wsf file extension and use cscript to access VBScript in a mixed format. In addition to eliminating the short flicker of the HTA window that appears and disappears, the advantage is that you can pass script parameters directly without accessing the environment (“process”) scope.




While hybrid Batch + JScript is easier. Using the .wsf method can also set both VBScript and JScript code as multiple jobs.

Leave a Comment

Your email address will not be published.