Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to write a batch script that can download some code from the web and infect a computer? Can you explain it briefly?

share|improve this question
up vote 1 down vote accepted

There's no mechanism within Windows batch file scripting to download files. You could use VBScript instead, though.

An alternative is to set up a network share on the same network as the target and copy a file across from there. This is a technique often used in penetration tests to gain further access to a network you've already got basic access to.

As Hendrik mentioned in the comments, it's possible to use in-built executables such as ftp.exe, vscript, WSH files and rundll32.exe to download files, though it may not be reliable across all systems.

share|improve this answer

Ultimately, a batch file can write another file and execute it. Batch files can write ASCII characters fine, but other byte values can be more tricky. There are ways to do it, e.g. that which is shown in this answer. On this page a much more thorough bootstrapping method is explained. On recent Windows, it would be simpler to produce a VBScript file and run it; or, even better, a PowerShell script.

An arbitrary executable file can then do anything, including downloading and uploading files, modifying other files in arbitrary ways, and, generally speaking, taking control of the whole machine.

share|improve this answer

That's easiest thing so far I understand. I made a... file that downloads files from FTP server and saves it, and then afterwards CMD would start the file so... final answer.

There are methods to hash the virus, so that Anti-Virus won't wake up; and, additional con, you need to have admin rights, to prevent any type of misfortunate happenings.

Batch: No.

Batch + VBScript: Yes.

share|improve this answer
Nothing better, than getting downvote because of giving on-topic correct answer. – Rik Telner Nov 4 '13 at 22:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.