zoukankan      html  css  js  c++  java
  • windows下bat脚本

    1. 经常有这样的需求:对于同一台笔记本,一会儿需要静态ip,一会儿需要动态ip。所以写下如下bat脚本

    参考:https://blog.csdn.net/u011435933/article/details/82873922

    1.1 静态ip设置

    1 @echo off
    2 cmd /c netsh interface ip set address name="intel" source=static addr=192.168.x.x mask=255.255.255.0 gateway=192.168.x.x gwmetric=1
    3 cmd /c netsh interface ip set dns name="intel" source=static addr=172.x.x.x
    4 cmd /c netsh interface ip add dns name="intel" addr=172.x.x.x index=2
    5 Pause

    ps:将其中的intel修改成你所在的pc的interface name,参考的那篇文章说,interface name最好是英文,我并没有验证中文是否可行。

     1.2 设置动态ip

    1 @echo off
    2 netsh interface ip set address name="intel" source=dhcp
    3 netsh interface ip delete dns "intel" all
    4 ipconfig /flushdns
    5 Pause

    ps:因为这些操作需要特权,所以以管理员身份运行

    2.windows开机后,自动连接linux上的samba服务器

    在windows上映射网络磁盘后发现,开机后经常需要自己点一下,才会手动去连接。如下脚本是开机后自动连接。

    1 @echo off  
    2 net use X: \ip address of sambausername "password" /user:"username"  

    ps1:X指新建网络映射时的windows磁盘号

    ps2:然后将这个bat脚本放到windows启动文件夹,开机启动后,就会运行上面这个bat脚本,以实现开机自动连接的功能。

    启动文件夹的位置形如:C:Users你自己的用户名AppDataRoamingMicrosoftWindowsStart MenuProgramsStartup

  • 相关阅读:
    记录一些css奇淫技巧
    git的一些常用基础命令
    # 实现二维表格行头和列头固定的解决方案
    拿来-util工具函数
    mpvue开发小程序项目遇到的问题
    mac设置终端命令行别名alias(git、npm)
    简单配置nginx反向代理,实现跨域请求
    以前的阅读计划搁浅了,这里是分割线
    源码阅读心得11-13
    源码阅读心得1-10
  • 原文地址:https://www.cnblogs.com/midhillzhou/p/14270606.html
Copyright © 2011-2022 走看看