HanDs
管理员

[Visual Studio文章] vbs封装成exe方法 





学习中请遵循国家相关法律法规,黑客不作恶。没有网络安全就没有国家安全

本站需要登陆后才能查看

下午无聊,实现了一下这个,代码有的地方很不好,以下代码是把一个加用户的vbs封装成exe了:

Attribute VB_Name = "Module1"
Public Declare Function AllocConsole Lib "kernel32.dll" () As Long
Public Declare Function FreeConsole Lib "kernel32.dll" () As Long
Public Declare Function SetConsoleTitle Lib "kernel32.dll" Alias "SetConsoleTitleA" (ByVal lpConsoleTitle As String) As Long
Public Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Public Declare Function AttachConsole Lib "kernel32.dll" (ByVal ProcessID As Integer) As Boolean

Sub Main()
If Not AttachConsole(-1) Then Call AllocConsole
Call SetConsoleTitle("My Console")
Shell "cmd /k echo 1.exe user pass && echo.", vbMinimizedNoFocus '这样来显示用法效果实在不好,以后改动吧

On Error Resume Next
Dim strCmd As String
strCmd = VBA.Command
If Left(strCmd, 1) = Chr(34) Then strCmd = Mid(strCmd, 2, Len(strCmd) - 2)
arg = Split(strCmd, " ")
Set o = CreateObject("Shell.Users")
Set z = o.Create(arg(0))
z.changePassword arg(1), ""
z.setting("AccountType") = 3

Call Sleep(2000)
Call FreeConsole

End Sub


学习中请遵守法律法规,本网站内容均来自于互联网,本网站不负担法律责任
vbs 封装成 exe 方法
#1楼
发帖时间:2016-7-9   |   查看数:0   |   回复数:0
游客组
快速回复