# 第四十五课：解决bat一句话下载payload黑窗

实战中，需要用 bat 解决的事情总会碰到，而针对不同的环境，可能同一件事情需要不同的方案。

## demo:测试bat

bat 内容：追加到bat.txt里。\
![](/files/-LZJx6PxvNTwhAm5ZKmL)

![](/files/-LZJx6PzClUqipLl-ejb)

## 附代码：

```bash
Set oShell = CreateObject ("Wscript.Shell")
Dim strArgs
strArgs = "cmd /c bat.bat"
oShell.Run strArgs, 0, false
```

但是代码过长，需要追加写入。需要简化下代码。\
![](/files/-LZJx6Q0NhNukP0UIxlL)

## 附代码：

```bash
CreateObject("Wscript.Shell").Run "bat.bat", 0, True
```

如果需要在目标机上执行多个 bat，如果需要把代码中的 bat.bat 变成变量的话。\
![](/files/-LZJx6Q2GugMUzJocd0Y)

## 附代码：

```bash
If WScript.Arguments.Count >= 1 Then
ReDim arr(WScript.Arguments.Count‐1)
For i = 0 To WScript.Arguments.Count‐1
Arg = WScript.Arguments(i)
If InStr(Arg, " ") > 0 Then Arg = """" & Arg & """"
arr(i) = Arg
Next 

RunCmd = Join(arr)
CreateObject("Wscript.Shell").Run RunCmd, 0, True
End If
```

> Micropoor


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://micro8.gitbook.io/micro8/contents-1/41-50/45-jie-jue-bat-yi-ju-hua-xia-zai-payload-hei-chuang.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
