主题:利用脚本复制新程序覆盖自身
delete file "K:\1.vbs"
s1= '[color=0000FF]Set fs = CreateObject("Scripting.FileSystemObject")[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]set WshShell = WScript.CreateObject("WScript.Shell")[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]WScript.Sleep 2000[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]fs.CopyFile "K:\temp\2.exe", "K:\",True[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]if msgbox("是否运行新程序",4)=6 then[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]WshShell.Exec("K:\2.exe")[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]end if[color=000000]' + CHR(13)+CHR(10)
STRTOFILE(s1,"K:\1.vbs")
M_WshShell=CreateObject("WScript.Shell")
M_WshShell.Exec("WScript.exe K:\1.vbs")
RELEASE M_WshShell
QUIT
安全起见,延迟两秒。
如果不延迟,有时候成功,有时候会因为程序来不及退出,而覆盖不成功。
s1= '[color=0000FF]Set fs = CreateObject("Scripting.FileSystemObject")[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]set WshShell = WScript.CreateObject("WScript.Shell")[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]WScript.Sleep 2000[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]fs.CopyFile "K:\temp\2.exe", "K:\",True[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]if msgbox("是否运行新程序",4)=6 then[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]WshShell.Exec("K:\2.exe")[color=000000]' + CHR(13)+CHR(10)
s1=s1+'[color=0000FF]end if[color=000000]' + CHR(13)+CHR(10)
STRTOFILE(s1,"K:\1.vbs")
M_WshShell=CreateObject("WScript.Shell")
M_WshShell.Exec("WScript.exe K:\1.vbs")
RELEASE M_WshShell
QUIT
安全起见,延迟两秒。
如果不延迟,有时候成功,有时候会因为程序来不及退出,而覆盖不成功。