JS invoke executable (EXE) file __js

Source: Internet
Author: User

JS invoke executable (EXE) file
<script language= "JavaScript" >
function Open_exe (SHELLP,STR)
{
A=new ActiveXObject ("Wscript.Shell");
A.run (shellp+ "" +str);
}

Function CQ ()
{
B=new ActiveXObject ("Wscript.Shell");
B.run ("Rundll32.exe")
}
</script>
<button onclick= "Open_exe (' notepad.exe ', ' C://ltdz1.txt ')" > Open notepad</button>
<button onclick= "Open_exe (' winword.exe ', ' C://long.doc ')" > Open word</button>
<button onclick= "Open_exe (' ACDSee.exe ', ' c://oaautomatic//images//apy.gif ')" > Open acdsee</button>
<button onclick= "CQ ();" > Restart </button>


*************************************************************************************************************** *********
*************************************************************************************************************** *********
1.0 use Java to invoke Windows system EXE files, such as Notepad,calc:
public class demo{
public static void Main (String args[]) {

Runtime Rn=runtime.getruntime ();
Process P=null;

try{
P=rn.exec (Notepad);
}catch (Exception e) {
System.out.println ("Error exec notepad");
}
}
}
2.0 invoke other executables, such as their own exe, or download the installed software
public class demo{
public static void Main (String args[]) {
Runtime Rn=runtime.getruntime ();
Process P=null;

try{
P=rn.exec ("/" d:/anyq/anyq.exe/"");
}catch (Exception e) {
System.out.println ("Error exec anyq");
}
}
}

############################################################################################################### ###########
############################################################################################################### ###########

Fscommand Call EXE file detailed
Author: Dragon Clan cool few type: Reprint Source: Flash bar Many friends in the post often ask: why my flash can not call the local machine EXE file, but as written but no mistakes, I wrote this AH



On (release) {
Fscommand ("exec", "***.exe");
}
Yes, rough looks, indeed there is no error in as, I started with this mode, but it is not called file, first of all, we have to understand the meaning of a few fscommand orders

Fscommand (cmd_string, arg_string) executes host-side directives. cmd_string Specifies the name of the instruction to be executed, which is Flashplayer
instruction or browser JavaScript functions. Arg_string the parameters used to declare the directive.
Flashplayer instructions are available (only for standalone players):
Whether "fullscreen" plays in full screen, with a parameter of TRUE or False
Whether "Allowscale" allows the movie to be scaled through the stretch window, with the argument true or False
Whether "ShowMenu" displays a menu in the player, and the argument is true or false
Whether "Trapallkeys" screens the player's shortcuts (for example, ESC means stop playback and restore
"Save" hides the attribute, which is the function of saving variables to a text file.
window), the argument is true or false. But the ALT+F4 system is fast
The key (Close window) is still available.
"Exec" runs the file specified by arg_string.

The following only describes the use of the EXEC command

exec is a command to invoke the local EXE file through the Flash file, let's look at the diagram below:

First, create a new folder named Myflash



Open Flash, add a button to the scene, and write the code in the AS panel:


On (release) {
Fscommand ("exec", "Popo.exe");
}
As for why to take EXE file name is Popo, this will explain in the later





Save just the Flash file as 1.fla and create a 1.swf file





Create a new folder under the same folder named Fscommand, which is the EXE file that you want to call later.





At this time you can put the exe file into the Fscommand folder, steel I use the Popo.exe file is actually NetEase bubble installation program, in fact, is not popo indifferent, as long as the exe for the drunken files can be





At this time some friends began to Enter+ctrl to test, but no response
Yes, my steel code is no problem ah, my road is no problem ah, why can not call the file it.

Actually, here's the problem.
Flash MX enhances security, although it can also invoke EXE files, but it is conditional.

1. Your flash file can not be SWF, but should be EXE file, such as 1.exe;
2. To create a new named Fscommand directory in the 1.exe directory, the external executable file you want to invoke is in the Fscommand directory

This sentence does not know that we have not read, said the popular point: SWF file can not directly call the EXE file. In other words, only you do the steel to do the button to call the Popo.exe 1.swf file into the exe file can be called Popo.exe, in fact, EXE call EXE pull, but the front of this EXE must be SWF conversion over

The conversion method is as follows:
Export EXE format
The publishing method is as follows:
Select the File-> Publish Settings or press Ctrl+shift+f12
Its default publication type is HTML (. html) and Flash (. swf),
You will cancel these two items and select Windows projectors (. exe)
You can publish your flash file directly as EXE executable file
Press CTRL+F12 to publish
If your file has not been saved, it will be posted in your Flash installation directory
If your file has been saved, it will be published in the same directory as your file
There is also a simpler way to:
First use the File-> Export Movie ... or press Ctrl+alt+shift+s to export the SWF file
Open this file again, create the player by file-> to produce exe executable file

You have to turn the SWF into this way:





Now open your 1.exe and click on the middle button to try it.





After all these steps, have you figured out a little bit of the rules and reasons for failure?

Let me summarize the above content for you:

First of all, call EXE file The most important point, you must first convert your SWF file to exe, that is, Flash Player, why first convert to EXE file. We all know that with the Macromedia Company's Flash software in the global rise, but also brought a flash upsurge, of course, more people are used in the commercial use, such as Flash home, do animation, which are motivated by the interests, if there is no money, No one is going to do it (except for amateurs like us, of course), so there are some people who take advantage of Flash, who use Flash's powerful features to sabotage the network, causing some users to suffer huge losses, One of the most important is because of the Fscommand command, in FLASHMX before the launch of the use of FLASH5 users in the use of this command, you can directly through the SWF to invoke EXE file (as long as you put the exe file in the Fscommand folder on the line), The destructive molecule is to use this loophole to some of the online flash files to attack and destroy activities, now the launch of the FLASHMX, but also to the as in this code into an EXE call EXE to execute commands, thus protecting the user's security

Second, you must put the EXE file you want to call the same directory under the Fscommand file, otherwise flash will not be able to find the specific path of the file

Also, if you don't want to put it in the folder, you can, but specify its location.

The specific methods are as follows:

Open an external executable program: the extension. exe can be omitted. Specifically, if an EXE file (assumed to be another.exe) and the SWF file itself are in the same directory, type the program file name directly. Such as:
Fscommand ("Exec", "another")
Otherwise, the path should be specified. For example, open IE browser window:
Fscommand ("exec", "C://progra~1//intern~1//iexplore")
Note the DOS for long file (folder) name processing form.
The following two kinds of cases can also not write the path--
(1) When the executable program is in the C:/windows directory, you can not write the path. If you call the Windows Calculator, here are three ways to:
Fscommand ("exec", "C://windows//calc.exe")
Fscommand ("exec", "C://windows//calc")
Fscommand ("Exec", "Calc")
(2) Calling DOS commands can also omit the path. The following example opens the edit editor under MS-DOS:
Fscommand ("exec", "edit.com")
If you are familiar with the writing of batch files, you can execute batch files by fscommand->exec command more than once.

Of course, I personally think that it is necessary to keep a good habit, so or copy an EXE file to the Fscommand folder:


############################################################################################################### #############
&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&
Calling programs directly on your computer with JavaScript page code

Simple tips for making Web pages, you can use the code in a Web page to invoke executable files directly from your computer.

Put the following code directly into the <body> of the HTML page.

<script language= "JScript" >
function Runcmd () {
File= "cmd.exe";
Wsh=new ActiveXObject ("Wscript.Shell");
Wsh.run (File);
}
</SCRIPT>

<a href= "#" onclick= "Runcmd (); return false; > Run cmd.exe</a>

Here we created a function runcmd () to directly call the Cmd.exe file in the computer, of course, if you call the other files directly to write the path clearly. (Example: C://folder//subfolder//application.exe). The above code we can call the executable file directly by clicking on a super connection.

If you want a visitor to open your Web page and call the executable file directly on your computer, simply modify the <body> tag.

<body onload= "Javascript:runcmd ();" >
Note: The above page will pop up to block information when it is opened. What if the above code is in Firefox?

Try it yourself. Please don't do anything bad. I'm not responsible.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.