简体   繁体   中英

How do I create and execute batch file in client machine using server side code?

I googled and searched for information regarding the title but most of them couldn't help much. I need your advise. Is this possible or is there any other way to do this?

FYI, the server is running on Unix OS and clients are all running on Windows OS.

Thanks in advance! I really appreciate your precious advise.

All the crackers and spammers on the globe want to know the same thing :-)

The most simple solution is to write a small command server and install that on all Windows clients. The command server should wait for connections from the main server, save the commands in a batch file and execute them. That should be just a couple of lines of code in any modern language.

If you want something bottled, you can try rexec by MKS . Just be aware of the security risks.

If you want to do this without installing anything on the Windows client, Google for malware sites or talk to someone with connections to organized crime.

尝试使用小程序。

Depends on the client / server relationship you're dealing with. An applet / ActiveX control might help if we're talking web server -> browser client, but without more information it's hard to be more definite.

We have actually done this before using traditional batch files (.BAT). It works like so:

  • The user clicks a link;
  • The server dynamically generates a .BAT (batch) file;
  • The user is prompted to save or execute the .BAT file;
  • If they select to execute, the .BAT file is executed on the local machine with the users permissions.

We were surprised this actually worked. More scay yet, with a registry key change, we could also suppress the save / execute dialog provided the site was added into the Intranet zone on Internet Explorer.

Agreed with above posters that there are better alternatives. Was just describing this solution as you specifically asked for a batch file :)

If you are running a Samba server on your UNIX host where the clients login too you get plenty of opportunities to runs jobs on your clients.

Alternatively there are plenty of distributed job services available (see the list at http://en.wikipedia.org/wiki/Job_scheduler ). An open source multi platform one is for example : http://www.sos-berlin.com/modules/cjaycontent/index.php?id=osource_scheduler_introduction_en.htm

But if you want a solution in this direction, you may better ask again in Serverfault.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM