|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『楼 主』:
[分享] 隐藏进程切换系统用户批处理程序
使用 LLM 解释/回答一下
@echo off
rem 隐藏运行进程
if "%1" == "hide" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" hide",0)(window.close)&&exit
:begin
rem 设置当前时间的下一分钟
set h=%time:~0,2%&&set m=%time:~3,2%&&set /a m+=1
rem 时分进位
if %m% gtr 59 set /a m=0&&set /a h+=1
rem 获得当前秒
set s=%time:~6,2%
rem 如果秒大于或等于56,直接执行切换
if %s% geq 56 goto start
rem 如果秒小于56,将剩余秒变微秒
if %s% lss 56 set /a s=(56-%time:~6,2%)*100
rem 执行延时程序
call :ProcDelay %s%
:start
rem 结束 Explorer.exe 进程
TaskKill /f /im Explorer.exe>nul 2>nul
rem 将 at 命令相关的服务设置为自动
sc config schedule start= auto>nul 2>nul
rem 添加一个任务计划(下分钟起执行)
at %h%:%m% /interactive %SystemRoot%\Explorer.exe>nul 2>nul
rem 延时删除全部任务计划
call :ProcDelay 500
at /delete /yes
rem 结束
goto end
rem 延时程序
:ProcDelay number
Setlocal EnableExtensions
for /f "tokens=1-4 delims=:. " %%h in ("%TIME%") do set start_=%%h%%i%%j%%k
:wait_
for /f "tokens=1-4 delims=:. " %%h in ("%TIME%") do set now_=%%h%%i%%j%%k
set /a diff_=%now_%-%start_%
if %diff_% lss %1 goto wait_
Endlocal
:end
Last edited by chishingchan on 2008-11-23 at 12:06 ]
```
@echo off
rem Hide the running process
if "%1" == "hide" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" hide",0)(window.close)&&exit
:begin
rem Set the next minute of the current time
set h=%time:~0,2%&&set m=%time:~3,2%&&set /a m+=1
rem Hour and minute carry
if %m% gtr 59 set /a m=0&&set /a h+=1
rem Get the current second
set s=%time:~6,2%
rem If the second is greater than or equal to 56, directly execute the switch
if %s% geq 56 goto start
rem If the second is less than 56, convert the remaining seconds to microseconds
if %s% lss 56 set /a s=(56-%time:~6,2%)*100
rem Execute the delay program
call :ProcDelay %s%
:start
rem End the Explorer.exe process
TaskKill /f /im Explorer.exe>nul 2>nul
rem Set the service related to the at command to automatic
sc config schedule start= auto>nul 2>nul
rem Add a task plan (execute starting from the next minute)
at %h%:%m% /interactive %SystemRoot%\Explorer.exe>nul 2>nul
rem Delay to delete all task plans
call :ProcDelay 500
at /delete /yes
rem End
goto end
rem Delay program
:ProcDelay number
Setlocal EnableExtensions
for /f "tokens=1-4 delims=:. " %%h in ("%TIME%") do set start_=%%h%%i%%j%%k
:wait_
for /f "tokens=1-4 delims=:. " %%h in ("%TIME%") do set now_=%%h%%i%%j%%k
set /a diff_=%now_%-%start_%
if %diff_% lss %1 goto wait_
Endlocal
:end
Last edited by chishingchan on 2008-11-23 at 12:06 ]
```
|
|
2008-2-19 12:24 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
返回到Administrator帐户时连快速启动栏的e快捷方式也没有了,只剩下个桌面的快捷方式。
可能出错的语句:
sc config schedule start= auto>nul 2>nul
at /delete /yes
Last edited by chishingchan on 2008-2-19 at 12:34 PM ]
When returning to the Administrator account, even the e shortcut in the quick launch bar is gone, leaving only the shortcut on the desktop.
Possible incorrect statements:
sc config schedule start= auto>nul 2>nul
at /delete /yes
Last edited by chishingchan on 2008-2-19 at 12:34 PM ]
|
|
2008-2-19 12:27 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2008-2-19 12:40 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Originally posted by fastslz at 2008-2-19 12:40 PM:
不知道你要干吗?有何意图?
这是一个切换为 SYSTEM 登录帐户的批处理:
表现为:执行批处理后隐藏自身,直到下一分钟起执行切换动作!
但有些 BUG !
表现为:第一次运行正常,即由 Administrator 切换到 SYSTEM !注销 SYSTEM 返回到 Administrator 再次运行即停留在空桌面(桌面什么也没有)
现在确定为 at /delete /yes 为出错的语句,注释掉此行即正常,但我不想运行此批处理后在任务计划残留已完成的任务。
请问如何处理?
Last edited by chishingchan on 2008-2-19 at 01:01 PM ]
Originally posted by fastslz at 2008-2-19 12:40 PM:
Don't know what you want to do? What's the intention?
This is a batch script to switch to the SYSTEM login account:
It shows that after executing the batch script, it hides itself until the next minute to perform the switch action!
But there are some BUGs!
It shows that the first run is normal, that is, switching from Administrator to SYSTEM! After logging out of SYSTEM and returning to Administrator, running it again stays on an empty desktop (nothing on the desktop)
Now it is determined that the line with at /delete /yes is the error statement. Commenting out this line is normal, but I don't want the completed task to remain in the task scheduler after running this batch script.
How to handle it?
Last edited by chishingchan on 2008-2-19 at 01:01 PM ]
|
|
2008-2-19 13:00 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
at /delete /yes是否存在权限
这个vbs的话很简单
Does the /delete /yes command have permission? This VBS is very simple
|

第一高手 第二高手
我的小站
 |
|
2008-2-19 13:12 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
第二次也在 Administrator 里运行的,权限应该是没问题的。
反正我也说不清,你可以测试一下上面的代码!
It was also run in Administrator the second time, so the permissions should be okay. Anyway, I can't explain it clearly, you can test the code above!
|
|
2008-2-19 13:42 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
Originally posted by chishingchan at 2008-2-19 13:42:
第二次也在 Administrator 里运行的,权限应该是没问题的。
反正我也说不清,你可以测试一下上面的代码!
我这里不存在你说的这个BUG
Originally posted by chishingchan at 2008-2-19 13:42:
The second time it was also run in Administrator, the permission should be no problem.
Anyway, I can't explain it clearly, you can test the above code!
There is no such bug as you mentioned here
|

第一高手 第二高手
我的小站
 |
|
2008-2-19 14:33 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
|
2008-2-19 14:35 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
|
2008-2-19 14:52 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
Set WsShell = CreateObject("WScript.Shell")
Set objWMI = Getobject("Winmgmts:")
Set Process=objWMI.ExecQuery("Select * From Win32_Process Where Name='Explorer.exe'")
For Each objProcess In Process
intReturn = objProcess.Terminate(1)
Next
SithTime = FormatDateTime (DateAdd("s",60,Time) ,0)
WsShell.Run ("%Comspec% /c "&Chr(34) &"sc config Schedule start= auto&net start Schedule" &Chr(34)),vbHide
Wscript.sleep 2000
WsShell.Run ("%Comspec% /c "&Chr(34) &"at " &SithTime & " /interactive %SystemRoot%\Explorer.exe" &Chr(34)),vbHide
Wscript.sleep 120000
WsShell.Run ("%Comspec% /c "&Chr(34) &"at /delete /yes" &Chr(34)),vbHide
```vb
Set WsShell = CreateObject("WScript.Shell")
Set objWMI = Getobject("Winmgmts:")
Set Process=objWMI.ExecQuery("Select * From Win32_Process Where Name='Explorer.exe'")
For Each objProcess In Process
intReturn = objProcess.Terminate(1)
Next
SithTime = FormatDateTime (DateAdd("s",60,Time) ,0)
WsShell.Run ("%Comspec% /c " & Chr(34) & "sc config Schedule start= auto&net start Schedule" & Chr(34)),vbHide
Wscript.sleep 2000
WsShell.Run ("%Comspec% /c " & Chr(34) & "at " & SithTime & " /interactive %SystemRoot%\Explorer.exe" & Chr(34)),vbHide
Wscript.sleep 120000
WsShell.Run ("%Comspec% /c " & Chr(34) & "at /delete /yes" & Chr(34)),vbHide
```
|

第一高手 第二高手
我的小站
 |
|
2008-2-19 14:54 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 11 楼』:
测试结果:
使用 LLM 解释/回答一下
1、等待空白桌面的时间太长了,能否在运行切换前3秒才执行动作?
2、任务计划残留已过时任务
3、和我的批处理脚本一样,快速启动栏的e快捷方式不见了,只剩下一个桌面的快捷方式!
4、第一项功能我的批处理做到了,其他与我的批处理相当,存在同样的问题!
希望改正!
总结:我还是喜欢批处理的方式,因对VBS不熟悉!
Last edited by chishingchan on 2008-2-19 at 03:14 PM ]
1. It takes too long to wait for the blank desktop. Can the action be executed only 3 seconds before the run switch?
2. Outdated tasks remain in the task plan.
3. Just like my batch script, the e shortcut in the quick launch bar is gone, leaving only a shortcut on the desktop!
4. The first function I achieved with my batch, the others are equivalent to my batch and have the same problem!
Hope to be corrected!
Summary: I still prefer the batch method because I am not familiar with VBS!
Last edited by chishingchan on 2008-2-19 at 03:14 PM ]
|
|
2008-2-19 15:12 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
Wscript.sleep 120000
2分钟减去等待at执行1分钟,也是是等待1分钟,可能时间长了点,但是也需要的(首次登入的话配置差一点的1分钟可能还未登入到桌面呢)
SithTime = FormatDateTime (DateAdd("s",60,Time) ,0)
这个是设置当前时间的下一分钟(60秒)
Wscript.sleep 1000 = 1秒
Wscript.sleep 120000
Subtract 1 minute from 2 minutes for the waiting of at execution, that is, waiting for 1 minute. Maybe it's a bit long, but it's also necessary. (For the first login, with a slightly worse configuration, it might not have logged in to the desktop in 1 minute)
SithTime = FormatDateTime (DateAdd("s",60,Time) ,0)
This is to set the next minute (60 seconds) of the current time
Wscript.sleep 1000 = 1 second
|

第一高手 第二高手
我的小站
 |
|
2008-2-19 15:16 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
fastslz 对顶楼的问题理解错了吧?!
1、非转换或改写为VBS
2、残留任务未得到解决!
3、e 快捷方式未得到解决!
4、新发现还有假死现象,表现为鼠标按桌面图标无反应,调出任务管理器注销登录过才正常!
fastslz misunderstood the question in the top post?!
1. Not converted or rewritten to VBS
2. Residual tasks not resolved!
3. e shortcut not resolved!
4. Newly discovered that there is also a deadlock phenomenon, manifested as no response when clicking desktop icons with the mouse, and it is normal only after logging out and logging in through the task manager!
|
|
2008-2-19 15:22 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
Originally posted by fastslz at 2008-2-19 02:33 PM:
我这里不存在你说的这个BUG
你不存在这个 BUG 的原因是你没有把残留的过时任务处理掉,我的批处理如果注释掉"at /delete /yes"也不存在(空桌面)错误的,但新问题会出现(残留过时任务)
其它如 e 的快捷方式和假死现象先抛开一边不说了!
Originally posted by fastslz at 2008-2-19 02:33 PM:
There is no such bug as you mentioned here
The reason you don't have this bug is that you haven't dealt with the remaining outdated tasks. If I comment out "at /delete /yes" in my batch file, there is no (blank desktop) error, but a new problem will occur (remaining outdated tasks)
Let's put aside other things like the shortcut of e and the unresponsive phenomenon!
|
|
2008-2-19 15:26 |
|
|
fastslz
铂金会员
       DOS一根葱
积分 5493
发帖 2315
注册 2006-5-1 来自 上海
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
1、批处理计算下一分钟是不精确的(即使做到很精确代码还更复杂),vbs分秒不差
2、残留任务没问题
3、e 快捷方式也没问题
4、也假死现象
5、总之~因个人系统状况而定
1. Batch processing to calculate the next minute is inaccurate (even if made very accurate, the code is more complicated), VBS is accurate to the second
2. Residual tasks are okay
3. The e shortcut is also okay
4. No freezes either
5. In short~It depends on the personal system situation
|

第一高手 第二高手
我的小站
 |
|
2008-2-19 15:30 |
|