zoukankan      html  css  js  c++  java
  • cmd开起远程桌面并显示ip

    前提:windows7

    '1关闭防火墙
    set objFirewall=CreateObject("HNetCfg.FwPolicy2")
    Const NET_FW_PROFILE2_DOMAIN = 1
    Const NET_FW_PROFILE2_PRIVATE = 2
    Const NET_FW_PROFILE2_PUBLIC = 4
    objFirewall.FirewallEnabled(NET_FW_PROFILE2_DOMAIN) = False
    objFirewall.FirewallEnabled(NET_FW_PROFILE2_PRIVATE) = False
    objFirewall.FirewallEnabled(NET_FW_PROFILE2_PUBLIC) = False
    '2开启服务
    set ws=createobject("wscript.shell")
    ws.run "cmd /c net start ""Remote Desktop Help Session Manager""",0,ture
    ws.run "cmd /c net start ""Remote Desktop Services""",0,ture
    '3设置远程的注册表
    Set vbsRegWrite = CreateObject("Wscript.Shell")
    Dim path
    path = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\"
    vbsRegWrite.RegWrite path & "fDenyTSConnections","0","REG_DWORD"
    '4获取ip
    Set WshShell = WScript.CreateObject("WScript.Shell")
    Set oExec = WshShell.Exec("ipconfig.exe")
    Set oStdOut = oExec.StdOut
    ip = ""
    Do Until oStdOut.AtEndOfStream
    strLine = oStdOut.ReadLine

    If InStr(strLine, "IPv4 地址") > 0 Then

    ip = Mid(strLine, InStr(strLine, ":") + 2)
    Exit Do
    End If
    Loop

    If ip = "" Then
    MsgBox "获取本地连接IP地址失败!", vbExclamation, "错误"
    WScript.Quit
    Else
    MsgBox ip, vbExclamation, "本地连接IP地址!"
    End If

    WScript.Quit

    做一个决定,并不难,难的是付诸行动,并且坚持到底。
  • 相关阅读:
    android xml 布局错误
    java int与integer的区别
    android html.fromHtml 用例
    Android 手势操作识别
    android android 判断是否滑动
    Android 通过 Intent 传递类对象或list对象
    android 学习JSON
    android 解决ListView点击与滑动事件冲突
    关于android的日志输出&LogCat
    android ListView 属性
  • 原文地址:https://www.cnblogs.com/wukc/p/13236153.html
Copyright © 2011-2022 走看看