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. generator mybatis逆向工程

    mybatis逆向工程:根据数据库中的表在项目中生成对应的 实体类,dao接口与mapper.xml映射文件 在eclipse中,以插件的形式的存在,把设置好的配置文件,直接通过eclipse中的插件 ...

  2. win10安装pytorch

    安装gpu版本的pytorch需要三个东西:pytorch(torchvision).cuda.cudnn 相信大家都安装过了anaconda,就不介绍anaconda的安装了 1.安装cuda:从官 ...

  3. python中的lambda表达式

    lambda是python中匿名函数的写法  我们可以在不定义函数名的情况下一边定义并调用这个函数 例子: 普通方法定义函数:def  plus(a,b): return a+b lambda方法  ...

  4. PCF学习知识

    1. 去PCF官网注册一个免费账号,地址是: https://login.run.pivotal.io/login 2.安装PCF的命名,cf cli. 地址https://pivotal.io/pl ...

  5. [RESTful] 设计要素

    如何设计RESTful API 资源路径(入何规划资源路径) HTTP动词(请求方式 GET/POST...) 过滤信息(分页,查询操作的时候进行信息过滤) 状态码(服务器端响应什么样的状态码) 错误 ...

  6. maven源码打包

    1.打包时附加外部Jar包 <!--编译+外部 Jar打包-->          <plugin>            <artifactId>maven-co ...

  7. Linux CentOS 7 下的C++ 学习笔记01

    1.虚拟机WMware 通过镜像安装CentOS 7系统(自行百度操作 虚拟机+镜像+安装一套都有) //安装时需要配置网络 //root设置密码   即为登录系统的账号和密码 2. C++ 环境设置 ...

  8. python3 进行字符串、日期、时间、时间戳相关转换

    1.字符串转换成时间戳 2. 日期转换成时间戳

  9. java接口深入

    1.抽象类. java常规类中,有些方法并不是固定的,而是在不同的情况下有不同的实现的,比如一个人,在公司要工作,在学校要学习,在食堂要吃饭,但是这个人还有相同的地方,比如不论在哪里都要呼吸,看,挺, ...

  10. jupyter notebook添加虚拟环境

    原本以为,当进入虚拟环境之后,再运行jupyter notebook应该是这个环境下的jupyter,比如我默认创建一个文件,这个文件调用的编译器应该是这个虚拟环境中的编译器,实际上并不是 当你进入j ...