Echo off

@ECHO OFF

echo string to generate the output

create a blank line

echo .

create a file

echo string >a.txt

create multiple lines to a file

echo off
(
echo Windows Registry Editor Version 5.00
echo.
echo [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\IAR Systems\Embedded Workbench\Lic\ARM\01]
set str="%cd%\Licenses\Embedded Workbench\ARM\01\License.ini"
echo "lservrc"="%str%"
)> "li.reg"

replace string

%string:SEARCH=REPLACE%

set str=%cd%\Licenses\Embedded Workbench\ARM\01\License.ini
echo %str%
set str=%str:\=\\%

To enable space in path

Using "command" in bat file: "C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4\common\bin\iarbuild.exe"

bat file is not recognized as an internal or external command

To restart a new command window to fix it.

Commen

REM your comment here

Power controlling in Windows

powercfg.exe /h off

powercfg.exe -change -monitor-timeout-ac 0
powercfg.exe -change -monitor-timeout-dc 0
powercfg.exe -change -disk-timeout-ac 0
powercfg.exe -change -disk-timeout-dc 0
powercfg.exe -change -standby-timeout-ac 0
powercfg.exe -change -standby-timeout-dc 0
powercfg.exe -change -hibernate-timeout-ac 0
powercfg.exe -change -hibernate-timeout-dc 0

Map network driver

@echo off
net use w: \\10.54.143.168\ /user:name 1
@echo on

set

set displays the current environment variable settings

path 

path displays the environment path

set path

setx path "%path%;yourpathhere"

another command is

set PATH="%path%;yourpathhere/" (it works in my system)

if else with paramter checking

IF NOT "%1" == "clean" (
"ninja.exe" -v
) ELSE (
"ninja.exe" -t clean
)

note that, the ) ELSE ( must be one line in my test.

Redirect "all" output to a single file:

genmake.bat >1.txt 2>&1

https://www.robvanderwoude.com/battech_redirection.php

check a folder or file exist

IF EXIST debug (

)

Variable

set dlib="C:\\Program Files (x86)\\IAR Systems\\Embedded Workbench 5.4\\arm\\INC\\DLib_Config_Normal.h"

"C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4\arm\bin\iccarm.exe" C:\cmakeExample\driver\74HC574.c -o C:\cmakeExample\Release\Obj\74HC574_fullpath.o --dlib_config %dlib% --no_unroll --no_inline --no_tbaa --no_scheduling --endian=little --cpu=Cortex-M3 -e --fpu=None -I C:\cmakeExample\STMLib\CMSIS\ -I C:\cmakeExample\STMLib\inc\ -I C:\cmakeExample\STMUSB\inc\ -I C:\cmakeExample\application\inputs\inc\ -I %abc% -Om

note, using "\\" to pass the parameter with space.

Windows batch file的更多相关文章

  1. run commands in linux shell using batch file

    adb shell as root after device rooted once device rooted, we must perform "su" before we g ...

  2. Launch a Batch File With Windows Installer

    Quote from: http://flexerasoftware.force.com/articles/en_US/HOWTO/Q111515 Synopsis This article desc ...

  3. How to run a batch file each time the computer loads Windows

    https://www.computerhope.com/issues/ch000322.htm#:~:text=Press Start%2C type Run%2C and press Enter. ...

  4. windows batch语法

    windows BATCH基本知识扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件. ==== 注 =============================== ...

  5. Use windows batch script to create menu

    Background Recently, I find that we need  to  type some very long gradle commands to run build, chec ...

  6. 深入浅出Windows BATCH

    1.什么是Windows BATCH BATCH也就是批处理文件,有时简称为BAT,是Windows平台上的一种可运行脚本,与*nix(Linux和Unix)上的Shell脚本和其它的脚本(Perl, ...

  7. Windows Batch 编程 和 Powershell 编程

    Batch Script - Functions with Return Values https://www.tutorialspoint.com/batch_script/batch_script ...

  8. CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台

    所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...

  9. Windows batch,echo到文件不成功,只打印出ECHO is on.

    jenkins 执行Windows batch command的时候,如果想要读写文件,echo到文件不成功. bat 代码如下: set ctime=%date%_%time% echo %ctim ...

随机推荐

  1. Windows10 安装QT问题

    在网上download qt-opensource-windows-x86-winrt-msvc2013-5.8.0.exe 版本安装完成后,New “Qt Widgets application” ...

  2. CentOS7.4+OpenStack-Queens版本部署

    一.准备工作.网络选择NAT 创建两台虚拟机:linux-node1.linux-node2 node1: 修改主机名 [root@localhost ~]# hostnamectl set-host ...

  3. jQuery 命名空间的使用

    jQuery 命名空间的使用: 1.利用 trigger 触发子元素带命名空间的事件,那么父元素带相同命名空间的事件也会被触发,而父元素没有命名空间的事件不会被触发. 2.利用 trigger 触发子 ...

  4. Python常用数据类型

    一 .列表 name = ['zhangshan', 'lishi', 'wangwu']# 列表赋值 name.append('liujun')# 增,默认增加到最后位置 name.insert(1 ...

  5. PHP安装过程中问题详解

    安装Apace时我就犯了一个大错误.因为我的母语是JAVA,我以为Tomcat就是Apache.其实不然,Tomcat是给Java用的,处理JSP等的动态页面. 而PHP则是单纯的用Apache安装A ...

  6. commons-lang常用方法

    跟java.lang这个包的作用类似,Commons Lang这一组API也是提供一些基础的.通用的操作和处理,如自动生成toString()的结果.自动实现hashCode()和equals()方法 ...

  7. zabbix添加IIS网站计数器(并发连接数)详解

    环境:windows server 2012 前提:IIS上要添加好配置   1,在被监控主机,powershell输入perfmon.msc   2,点击添加按钮     3,在下拉菜单中点击小箭头 ...

  8. [转载] java多线程总结(一)

    转载自:http://www.cnblogs.com/lwbqqyumidi/p/3804883.html 作者:Windstep 多线程作为Java中很重要的一个知识点,在此还是有必要总结一下的. ...

  9. web 自定义标签

    Web Components 标准非常重要的一个特性是,它使开发者能够将HTML页面的功能封装为 custom elements(自定义标签).而自定义标签的好处,就是在大型web开发的时候,可以封装 ...

  10. div嵌套,常见左右分类栏目

    最终效果图如下: html代码如下: <div class="smalItem"> <div class="leftnav"> < ...