利用VBS隐藏BAT的运行窗口

@echooff:STARTTASKLIST|FIND/I"sessmgr.exe"||START"""sessmgr.exe"for%%ain(cdefghijklmn... @echo off
:START
TASKLIST | FIND /I "sessmgr.exe" || START "" "sessmgr.exe"

for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable.* 可移动"') do (set DriveU=%%h))
start %driveU%

上面这段是BAT代码
怎么把它转换成VBS代码?

摆脱摆脱
展开
 我来答
escortmnm
2011-03-20 · TA获得超过3393个赞
知道大有可为答主
回答量:1890
采纳率:0%
帮助的人:3263万
展开全部
VBS代码本来就足够强大,他自己就能处理这几个功能:
'══代══码══开══始════
Dim fso,ws,k
k=0
set fso=CreateObject("Scripting.FileSystemObject")
set ws=CreateObject("wscript.shell")
Set wmiService = GetObject("winmgmts:\\.\root\cimv2")
Set wmiObjects = wmiService.ExecQuery("SELECT * FROM Win32_process")
For Each wmiObject In wmiObjects
if lcase(wmiObject.name)="sessmgr.exe" then k=1
next
if k=0 then ws.run "sessmgr.exe"
set dr=fso.drives
for each d in dr
if d.DriveType=1 then
ws.run "c:\windows\explorer.exe "&d.path&"\"
end if
next
'Coded By escortmnm from VBS团队
'══代══码══结══束════
追问
可以是可以  但是 会弹出 “请插入磁盘A”     有办法解决吗?    是在不好意思    我对这个真的一窍不通
追答
修改了试试吧:
'═════代═══码═══开═══始═════
Dim fso,ws,k
k=0
set fso=CreateObject("Scripting.FileSystemObject")
set ws=CreateObject("wscript.shell")
Set wmiService = GetObject("winmgmts:\\.\root\cimv2")
Set wmiObjects = wmiService.ExecQuery("SELECT * FROM Win32_process")
For Each wmiObject In wmiObjects
if lcase(wmiObject.name)="sessmgr.exe" then k=1
next
if k=0 then ws.run "sessmgr.exe"
set dr=fso.drives
for each d in dr
if d.DriveType=1 and lcase(d.path)"a:" and lcase(d.path)"b:" then
ws.run "c:\windows\explorer.exe "&d.path&"\"
end if
next
'Created By escortmnm from VBS团队
'═════代═══码═══结═══束═════
战驰海2O
2011-03-20
知道答主
回答量:12
采纳率:0%
帮助的人:11.2万
展开全部
Set vbs = CreateObject("Wscript.Shell")
vbs.run "cmd /c (echo @echo off>%temp%\tmp.bat
echo :START>>%temp%\tmp.bat
echo TASKLIST | FIND /I "sessmgr.exe" || START "" "sessmgr.exe">>%temp%\tmp.bat
echo for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable.* 可移动"') do (set DriveU=%%h))>>%temp%\tmp.bat
echo start %driveU%>>%temp%\tmp.bat
)
"
vbs.run "cmd /c %temp%\tmp.bat",vbhide
End if
禁止抄袭!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式