• 批处理文件


    https://technet.microsoft.com/en-us/library/cc754340.aspx

    https://gallery.technet.microsoft.com/ScriptCenter/  学习powershell脚本的好地方

    command shell

    explorer shell

    Windows shell extension (tortoiseSVN)

    百度百科--批处理

    批处理文件

    dos命令参考~~~

    DOS Batch 命令

    如何替换Windows的Shell(即explorer.exe)

    :test

    ::

    echo off

    @

    ECHO OFF可以关闭掉整个批处理命令的回显,但不能关掉ECHO OFF这个命令本身,现在我们在ECHO OFF这个命令前加个@,就可以达到所有命令均不回显的要求。该符号在批处理中的作用是关闭当前行命令的回显,也就是不显示执行的是什么命令,只显示命令的结果!

    rem

    %

    @echo off
    rem echo 正在进行静态IP设置,请稍等...
    rem pause
    rem echo bye!
    echo %1 (打印: "hello")
    echo %2 (打印: "haha")
    echo %0 (打印: test2.bat)
    echo %19 (打印: "hello"9)

    一个参考样本如下:

    @echo off
    cls
    color 0A
    echo ip地址更改小工具
    
    set addr1=192.168.1.88
    set mask1=255.255.255.192
    set gateway1=192.168.1.126
    
    set addr4=192.168.1.87
    set mask4=255.255.255.192
    set gateway4=192.168.1.126
    
    set addr5=192.168.0.88
    set mask5=255.255.255.0
    set gateway5=192.168.0.1
    
    set addr2=192.168.2.88
    set mask2=255.255.255.0
    set gateway2=192.168.2.254
    
    set addr3=172.16.1.88
    set mask3=255.255.255.128
    set gateway3=172.16.1.126
    
    set name1="本地连接"
    set name2="无线网络连接"
    set dns1="8.8.8.8"
    set dns2="218.30.19.40"
    set dns3="8.8.4.4"
    
    rem 分别有不同的格式,灵活设置
    echo.
    echo 1 设置有线为静态常用ip
    echo.
    echo 2 设置有线为动态ip
    echo.
    echo 3 启用无线且静态设置ip
    echo.
    echo 4 禁用无线启用有线
    echo.
    echo ---请选择项目后回车
    
    set /p answer=[你的选择是:]
    if %answer%==1 goto 1
    if %answer%==2 goto 2
    if %answer%==3 goto 3
    if %answer%==4 goto 4
    
    :1
    echo 你选择了恢复到默认(常用)ip地址
    netsh interface ip set address %name1% static %addr1% %mask1% %gateway1%
    netsh interface ip add dns %name1% %dns1%
    netsh interface ip add dns name=%name1% addr=%dns2% index=2
    pause
    goto end
    :2
    echo 你选择了自动获取ip地址
    netsh interface ip set address %name1% source=dhcp
    netsh interface ip add dns %name1% %dns3%
    pause
    goto end
    :3
    echo 你选择了启用无线并禁用有线且静态设置ip
    netsh interface set interface name = "无线网络连接" admin=ENABLED
    rem netsh interface ip set address %name2% static %addr5% %mask5% %gateway5%
    rem netsh interface ip add dns %name2% %dns2%
    rem netsh interface ip add dns name=%name2% addr=%dns3% index=2
    netsh interface set interface name = "本地连接" admin=disabled
    pause
    goto end
    :4
    echo 你选择了禁用无线启用有线
    netsh interface set interface name = "无线网络连接" admin=disabled
    netsh interface set interface name = "本地连接" admin=enabled
    pause
    goto end
    :end
    echo.

    C:Userswjk1Downloads>echo %date%
    2016/03/29 周二
    C:Userswjk1Downloads>md %date:~0,4%%date:~5,2%%date:~8,2%
    结果就是创建了这个目录20160329

    比如在系统中date这个环境变量的值为
    2011-07-23 星期六

    %date:~0,4%  表示指针从左向右偏移0位,然后从偏移处开始提取4位字符,结果是2011
    %date:~5,2%  表示指针从左向右偏移5位,然后从偏移处开始提取2位字符,结果是07
    %date:~5%    表示指针从左向右偏移5位,然后提取所有的值
    %date:~-5%   表示指针反方向偏移,从最右端开始,偏移5位,然后从指针处提取左边的所有数值。
    md F:ackup\%date:~0,4%%date:~5,2%%time:~0,2%%time:~3,2%

    结果为:md F:201107231855

    一段批处理
    Net use \192.168.1.253ipc$ sin0PES /user:LEO
    md %date:~0,4%%date:~5,2%%date:~8,2%
    svnadmin hotcopy D:RepositoriesSinoPes-xa \192.168.1.253SvnBak\%date:~0,4%%date:~5,2%%date:~8,2%
  • 相关阅读:
    U**ty a*d Cooperat*o* Are the I*ter*at*o*al Commu**ty's Most *ote*t Weapo* to Overcome the *a*dem*c *art1
    Easy win for Barca as Messi pays homage to Maradona and Lenglet suffers ankle injury
    Ch**a's ma**ed submers*ble Fe*douzhe retur*s after ocea* exped*t*o*
    Documentarian Michael Wood: Chinese people key to reform 2020-11-28
    Timeline of Argentine football legend Maradona's life 2020-11-27
    Chang'e 5 sets out to collect moon samples in landmark mission 2020-11-25
    US companies looking at China for growth, says CNBC 2020-11-24
    [SJ-20-JCR2]-COMPLETE COVERAGE
    Latex应用语法记录
    排序算法学习
  • 原文地址:https://www.cnblogs.com/createyuan/p/4395687.html
Copyright © 2020-2023  润新知