一、
LiveUpdate.dat的文件删除了,然后再启动
二、
##################################begin####################
@echo off
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c%~s0::","","runas",1)(window.close)
title Xshell启动器
set atime=%date:~0,4%-%date:~5,2%-%date:~8,2%
#设置系统时间
date 2018-12-31
#改成你的xshell启动路径
start "" "D:\Program Files (x86)\NetSarang\Xshell 7\Xshell.exe"
echo 启动软件中...
ping 0.0.0.0 -n 10> null
echo 同步时间中,完成后自动关闭窗口...
date %atime%
三、这个脚本更好用
@echo off
color 3e
title Xshell启动器
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c "^&chr(34)^&"%~0"^&chr(34)^&" ::","%cd%","runas",1)(window.close)&&exit
::获取Xshell启动程序路径
::set Xshell="D:\Program Files (x86)\NetSarang\Xshell 7\Xshell.exe"
set Xshell=
::如果上边未设置Xshell变量值,那么会自动去查找当前已安装的Xshell路径
if not defined Xshell (
for /F "delims=" %%T in ('where Xshell') do set Xshell="%%T"
)
::如果上边两处都没有得到Xshell路径,那么就由用户手动输入
if not defined Xshell (
echo 请提供Xshell启动程序路径
set /P Xshell=
)
if not defined Xshell (
echo 拜拜我不干了!
exit
)
::在更改系统日期前,先获取系统当前日期
set cTime=%date:~0,4%-%date:~5,2%-%date:~8,2%
::修改系统日期,这里获取Xshell.exe的创建时间作为设置的系统日期
for /F "delims=" %%S in ('dir ^/TC %Xshell% ^| findstr "Xshell.exe"') do set Ftime=%%S
set fctime=%Ftime:~0,4%-%Ftime:~5,2%-%Ftime:~8,2%
date %fctime%
echo 修改系统日期完成
::启动Xshell程序
start "" %Xshell%
echo 等待Xshell启动中
::等待xshell启动完成
timeout /T 10 /NOBREAK
::ping 0.0.0.0 -n 5> nul
echo Xshell启动完成
::恢复系统日期
echo 恢复系统日期
date %cTime%
::ping 0.0.0.0 -n 5> null
::第二部分,为当前脚本创建.lnk快捷方式,放到用户桌面
::把原有的lnk快捷方式删掉,注意有的是在public桌面,有的是在当前user桌面
if exist "%PUBLIC%\Desktop\Xshell 7.lnk" (del /f /q "%PUBLIC%\Desktop\Xshell 7.lnk")
if exist "%USERPROFILE%\Desktop\Xshell 7.lnk" (del /f /q "%USERPROFILE%\Desktop\Xshell 7.lnk")
::由Xshell.bat创建的快捷方式,不存在才创建
set Desktop=%PUBLIC%\Desktop
if exist %Desktop%\Xshell.lnk goto:EOF
::切换到Xshell.bat脚本所在目录
cd /d %~dp0
::创建一个临时的vbs脚本, 写入以下内容.
::创建一个 wscript.shell 对象.
echo set wshell = WScript.CreateObject("WScript.Shell") > create_shortcut.vbs
::在 vbs 脚本中声明快捷方式路径及名称,放到用户桌面
echo file_lnk = "%Desktop%\Xshell.lnk" >> create_shortcut.vbs
::创建一个 shortcut 对象.
echo set shortcut = wshell.CreateShortcut(file_lnk) >> create_shortcut.vbs
::下面开始设置 shortcut 对象的属性.
::1. 将目标路径设置为当前批处理脚本 Xshell7.bat
echo shortcut.TargetPath = "%cd%\Xshell7.bat" >> create_shortcut.vbs
::2. 为 Xshell.bat 设置参数(当然这里不需要)
:: echo shortcut.Arguments = "A B C" >> create_shortcut.vbs
::3. 将 "Xshell.bat所在目录" 设置为起始目录
:: 注意这里双写百分号用来避免百分号被转义 (即双写百分号表示单个 "%").
echo shortcut.WorkingDirectory = "%%cd%%" >> create_shortcut.vbs
::4. 添加快捷方式描述 (可选).
echo shortcut.Description = "Powerful TELNET/SSH terminal emulator" >> create_shortcut.vbs
::5. 添加快捷方式图标 (可选).
echo shortcut.IconLocation = %Xshell% >> create_shortcut.vbs
::6. 保存 vbs 脚本.
echo shortcut.Save >> create_shortcut.vbs
::执行vbs脚本.
cscript create_shortcut.vbs
::删除临时的vbs脚本.
del /f /q create_shortcut.vbs
exit

1万+

被折叠的 条评论
为什么被折叠?



