无忧启动论坛
标题:
Win8.1 开机自动虚拟WiFi+延时启动联网应用+断网自动关机
[打印本页]
作者:
Medivh
时间:
2013-11-8 20:48
标题:
Win8.1 开机自动虚拟WiFi+延时启动联网应用+断网自动关机
[原创]Win8.1 开机自动虚拟WiFi+延时启动联网应用+断网自动关机
1.【App Delay Start.CMD】.xml原码将任意盘替换为真实路径后存为【App Delay Start.CMD】.xml文件
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2013-11-07T22:29:37.0226174</Date>
<Author>coollove</Author>
<Description>App Delay Start.CMD本BaT用来开机自动检测联网状态。网络连接时启动用户自定义程序及虚拟 AP;网络断开时自动关机(虚拟 AP 首次使用请按如下说明手动设置共享)。
移动【鼠标指针】到桌面右下方的网络状态图标,右键点击【打开网络和共享中心】在弹出窗口左侧点击【更改适配器设置】
打开【网络连接】窗口右键点击已连接到Internet的网络连接选择【属性(R)】切换到【共享】选项卡
勾选“允许其他网络用户通过此计算机的Internet来连接(N)”复选框;
在家庭网络连接(H):下拉列表选择允许共享Internet的网络连接(Microsoft 托管网络虚拟适配器),一般是【无线网络连接*N】</Description>
</RegistrationInfo>
<Triggers>
<LogonTrigger id="TriggerId_ruanmei">
<StartBoundary>2013-08-30T15:00:08</StartBoundary>
<Enabled>true</Enabled>
</LogonTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>ITHINKPAD\Coollove</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
<UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
<WakeToRun>true</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>"任意盘\iApp\Run\App Delay Start.CMD"</Command>
<Arguments></Arguments>
<WorkingDirectory>任意盘\iApp\Run\</WorkingDirectory>
</Exec>
</Actions>
</Task>
复制代码
2.App Delay Start.CMD原码将宽带连接 用户名 密码替换为真实信息后存为App Delay Start.CMD文件放入任意盘\iApp\Run文件夹;要开机自启动的快捷方式文件(*.lnk)放入任意盘\iApp文件夹;打开控制面板\所有控制面板项\管理工具\任务计划程序导入任务【App Delay Start.CMD】.xml
::
@echo off & mode con cols=35 lines=2 & color 5a
cd /d %~dp0
if "%1" == "h" goto Begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
ping -n 1 -w 60000 www.QQ.com >nul || echo %date% %time:~0,8%断开网络 >> "Access Connections time.txt"
:Begin
Rasdial 宽带连接 用户名 密码
ping -n 1 -w 60000 www.Baidu.com >nul && goto Start
goto Begin
:Start
echo %date% %time:~0,8%连接网络 >> "Access Connections time.txt"
netsh wlan set hostednetwork mode=allow ssid=Magnet key=858802788
netsh wlan start hostednetwork
for %%i in (.."*.lnk") do (ping -n 9 208.67.220.220 >nul && start "" "%%i")
goto Access
:Access
set ip1=www.etao.com
set ip2=8.8.8.8
set ip3=208.67.222.222
set/a n0=3
set/p=正在监测网络 ... <nul
set/a m2=0
set/a m1+=1
title 数据包:丢失%m2% / %m1%
ping -n 1 -w 60000 9 >nul
ping -n 1 %ip1%>nul&&(set n=0&goto Access)
set/a m2+=1
title 数据包:丢失%m2% / %m1%
ping -n 1 -w 60000 9 >nul
ping -n 1 %ip2%>nul&&(set n=0&goto Access)
set/a m3+=1
title 数据包:丢失%m2% / %m1%
ping -n 1 -w 60000 9 >nul
ping -n 1 %ip3%>nul&&(set n=0&goto Access)
set/a n+=1
if %n% lss %n0% goto Access
echo/&echo/&echo. 网络断开,即将关机&ping -n 3 127.1>nul
echo %date% %time:~0,8%断开网络 >> "Access Connections time.txt"
netsh wlan stop hostednetwork
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /f
REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged" /f
Shutdown -f -s -t 300 && goto Reset
:Reset
Rasdial 宽带连接 用户名 密码
set ip1=www.etao.com
set ip2=8.8.8.8
set ip3=208.67.222.222
set/a n0=3
set/p=正在监测网络 ... <nul
set/a m2=0
set/a m1+=1
title 数据包:丢失%m2% / %m1%
ping -n 1 -w 60000 9 >nul
ping -n 1 %ip1%>nul || (set n=0&goto Reset)
set/a m2+=1
title 数据包:丢失%m2% / %m1%
ping -n 1 -w 60000 9 >nul
ping -n 1 %ip2%>nul || (set n=0&goto Reset)
set/a m3+=1
title 数据包:丢失%m2% / %m1%
ping -n 1 -w 60000 9 >nul
ping -n 1 %ip3%>nul || (set n=0&goto Reset)
set/a n+=1
if %n% lss %n0% goto Reset
echo/&echo/&echo. 网络连接,取消关机&ping -n 3 127.1>nul
echo %date% %time:~0,8%连接网络 >> "Access Connections time.txt"
netsh wlan start hostednetwork
Shutdown -a && goto Access
::
复制代码
欢迎光临 无忧启动论坛 (http://wuyou.net./)
Powered by Discuz! X3.3