无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 4563|回复: 0
打印 上一主题 下一主题

[原创] Win8.1 开机自动虚拟WiFi+延时启动联网应用+断网自动关机

[复制链接]
跳转到指定楼层
1#
发表于 2013-11-8 20:48:21 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
[原创]Win8.1 开机自动虚拟WiFi+延时启动联网应用+断网自动关机

1.【App Delay Start.CMD】.xml原码将任意盘替换为真实路径后存为【App Delay Start.CMD】.xml文件
  1. <?xml version="1.0" encoding="UTF-16"?>
  2. <Task version="1.4" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  3. <RegistrationInfo>
  4. <Date>2013-11-07T22:29:37.0226174</Date>
  5. <Author>coollove</Author>
  6. <Description>App Delay Start.CMD本BaT用来开机自动检测联网状态。网络连接时启动用户自定义程序及虚拟 AP;网络断开时自动关机(虚拟 AP 首次使用请按如下说明手动设置共享)。
  7. 移动【鼠标指针】到桌面右下方的网络状态图标,右键点击【打开网络和共享中心】在弹出窗口左侧点击【更改适配器设置】
  8. 打开【网络连接】窗口右键点击已连接到Internet的网络连接选择【属性(R)】切换到【共享】选项卡
  9. 勾选“允许其他网络用户通过此计算机的Internet来连接(N)”复选框;
  10. 在家庭网络连接(H):下拉列表选择允许共享Internet的网络连接(Microsoft 托管网络虚拟适配器),一般是【无线网络连接*N】</Description>
  11. </RegistrationInfo>
  12. <Triggers>
  13. <LogonTrigger id="TriggerId_ruanmei">
  14. <StartBoundary>2013-08-30T15:00:08</StartBoundary>
  15. <Enabled>true</Enabled>
  16. </LogonTrigger>
  17. </Triggers>
  18. <Principals>
  19. <Principal id="Author">
  20. <UserId>ITHINKPAD\Coollove</UserId>
  21. <LogonType>InteractiveToken</LogonType>
  22. <RunLevel>HighestAvailable</RunLevel>
  23. </Principal>
  24. </Principals>
  25. <Settings>
  26. <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
  27. <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
  28. <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
  29. <AllowHardTerminate>true</AllowHardTerminate>
  30. <StartWhenAvailable>true</StartWhenAvailable>
  31. <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
  32. <IdleSettings>
  33. <StopOnIdleEnd>true</StopOnIdleEnd>
  34. <RestartOnIdle>false</RestartOnIdle>
  35. </IdleSettings>
  36. <AllowStartOnDemand>true</AllowStartOnDemand>
  37. <Enabled>true</Enabled>
  38. <Hidden>false</Hidden>
  39. <RunOnlyIfIdle>false</RunOnlyIfIdle>
  40. <DisallowStartOnRemoteAppSession>false</DisallowStartOnRemoteAppSession>
  41. <UseUnifiedSchedulingEngine>false</UseUnifiedSchedulingEngine>
  42. <WakeToRun>true</WakeToRun>
  43. <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
  44. <Priority>7</Priority>
  45. </Settings>
  46. <Actions Context="Author">
  47. <Exec>
  48. <Command>"任意盘\iApp\Run\App Delay Start.CMD"</Command>
  49. <Arguments></Arguments>
  50. <WorkingDirectory>任意盘\iApp\Run\</WorkingDirectory>
  51. </Exec>
  52. </Actions>
  53. </Task>
复制代码
2.App Delay Start.CMD原码将宽带连接 用户名 密码替换为真实信息后存为App Delay Start.CMD文件放入任意盘\iApp\Run文件夹;要开机自启动的快捷方式文件(*.lnk)放入任意盘\iApp文件夹;打开控制面板\所有控制面板项\管理工具\任务计划程序导入任务【App Delay Start.CMD】.xml
  1. ::
  2. @echo off & mode con cols=35 lines=2 & color 5a


  3. cd /d %~dp0
  4. if "%1" == "h" goto Begin
  5. mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit


  6. ping -n 1 -w 60000 www.QQ.com >nul || echo %date% %time:~0,8%断开网络 >> "Access Connections time.txt"


  7. :Begin


  8. Rasdial 宽带连接 用户名 密码
  9. ping -n 1 -w 60000 www.Baidu.com >nul && goto Start
  10. goto Begin


  11. :Start


  12. echo %date% %time:~0,8%连接网络 >> "Access Connections time.txt"
  13. netsh wlan set hostednetwork mode=allow ssid=Magnet key=858802788
  14. netsh wlan start hostednetwork
  15. for %%i in (.."*.lnk") do (ping -n 9 208.67.220.220 >nul && start "" "%%i")
  16. goto Access


  17. :Access


  18. set ip1=www.etao.com
  19. set ip2=8.8.8.8
  20. set ip3=208.67.222.222
  21. set/a n0=3
  22. set/p=正在监测网络 ... <nul
  23. set/a m2=0
  24. set/a m1+=1
  25. title 数据包:丢失%m2% / %m1%
  26. ping -n 1 -w 60000 9 >nul
  27. ping -n 1 %ip1%>nul&&(set n=0&goto Access)
  28. set/a m2+=1
  29. title 数据包:丢失%m2% / %m1%
  30. ping -n 1 -w 60000 9 >nul
  31. ping -n 1 %ip2%>nul&&(set n=0&goto Access)
  32. set/a m3+=1
  33. title 数据包:丢失%m2% / %m1%
  34. ping -n 1 -w 60000 9 >nul
  35. ping -n 1 %ip3%>nul&&(set n=0&goto Access)
  36. set/a n+=1
  37. if %n% lss %n0% goto Access
  38. echo/&echo/&echo. 网络断开,即将关机&ping -n 3 127.1>nul
  39. echo %date% %time:~0,8%断开网络 >> "Access Connections time.txt"
  40. netsh wlan stop hostednetwork
  41. REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /f
  42. REG DELETE "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Signatures\Unmanaged" /f
  43. Shutdown -f -s -t 300 && goto Reset


  44. :Reset


  45. Rasdial 宽带连接 用户名 密码
  46. set ip1=www.etao.com
  47. set ip2=8.8.8.8
  48. set ip3=208.67.222.222
  49. set/a n0=3
  50. set/p=正在监测网络 ... <nul
  51. set/a m2=0
  52. set/a m1+=1
  53. title 数据包:丢失%m2% / %m1%
  54. ping -n 1 -w 60000 9 >nul
  55. ping -n 1 %ip1%>nul || (set n=0&goto Reset)
  56. set/a m2+=1
  57. title 数据包:丢失%m2% / %m1%
  58. ping -n 1 -w 60000 9 >nul
  59. ping -n 1 %ip2%>nul || (set n=0&goto Reset)
  60. set/a m3+=1
  61. title 数据包:丢失%m2% / %m1%
  62. ping -n 1 -w 60000 9 >nul
  63. ping -n 1 %ip3%>nul || (set n=0&goto Reset)
  64. set/a n+=1
  65. if %n% lss %n0% goto Reset
  66. echo/&echo/&echo. 网络连接,取消关机&ping -n 3 127.1>nul
  67. echo %date% %time:~0,8%连接网络 >> "Access Connections time.txt"
  68. netsh wlan start hostednetwork
  69. Shutdown -a && goto Access
  70. ::
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-11-17 04:32

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表