> For the complete documentation index, see [llms.txt](https://micro8.gitbook.io/micro8/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://micro8.gitbook.io/micro8/contents-1/41-50/45-jie-jue-bat-yi-ju-hua-xia-zai-payload-hei-chuang.md).

# 第四十五课：解决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
