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. JS之工厂模式

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  2. jQuery的 ready() 和原生 Js onload() 的主要区别:

    1. onload() 会等到DOM 元素和图片都加载完毕后才执行:raeady()会等到DOM元素加载完毕,但不会等到图片加载完毕就会执行. 2.onload() 如果编写了多个,则后面的会覆盖掉前 ...

  3. linux部署小结

    一.连接外网1.配置网卡 vi /etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=static IPADDR= PREFIX= GATEWAY= ...

  4. 20165214 2018-2019-2 《网络对抗技术》Exp4 恶意代码分析 Week6

    <网络对抗技术>Exp3 免杀原理与实践 Week5 一.实验目标与内容 1.实践目标 1.1是监控你自己系统的运行状态,看有没有可疑的程序在运行. 1.2是分析一个恶意软件,就分析Exp ...

  5. .Net Core+Angular6 学习 第二部分(创建Angular6项目)

    . 创建angular6 前提: 需要安装nodejs以及angular的脚手架,Angular官网要求Angular6.0必须在node 8.x 和 npm 5.x 以上的版本才能正常使用. 我的版 ...

  6. IP通信基础课堂笔记----第二章(重点)

    TCP报文及传输 TCP报文主要学习的内容包括,报文格式.连接管理.流量控制.差错控制. TCP报文是由报文头部和数据两个部分组成.占20字节的报文头部包括源端口.位目的端口.序号..确认号.首部长度 ...

  7. ThreadPoolExecutor使用

    构造方法参数讲解  参数名 作用 corePoolSize 核心线程池大小 maximumPoolSize 最大线程池大小 keepAliveTime 线程池中超过corePoolSize数目的空闲线 ...

  8. holer实现外网访问本地tomcat

    外网访问内网Tomcat 内网主机上安装了Tomcat,只能在局域网内访问,怎样从公网也能访问本地Tomcat? 本文将介绍使用holer实现的具体步骤. 1. 准备工作 1.1 安装Java 1.7 ...

  9. ES6 let&const

    今天来总结一下ES6里面let与const的用法 先总体看一下ES6中的let都有哪些特性: let 特性 let声明的变量在js中不可以重复声明,防止变量的污染和覆盖 let声明的变量不涉及变量的提 ...

  10. 在终端中使用vim命令修改某些文件,会提示文件只读模式,可以执行以下命令强制写入

    在末行模式中输入以下命令 :w !sudo tee % 回车后可能需要输入密码