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. 1.5 select编写

    1.with:用于指定临时命名的结果 2.select A from B   在B中查看A 3.into 插入语句  例如:select A.B into 表1 from 表2 4.where 指定搜 ...

  2. java跨域

    在我们开发当中  经常会碰见跨域问题 今天我来说下 我在工作撞见的跨域: 一.首先我们要了解跨域存在的原因 1.浏览器限制 2.跨域(域名,端口不一样都是跨域) 3.XHR(XMLHttpReques ...

  3. 第一次靶场练习:SQL注入(1)

    SQL注入1 本文章目的是对相关的黑客内容进一步了解,如有人违反相关的法律法规,本人概不负责 一.学习目的: 利用手工注入网站 利用sqlmab注入 二.附件说明 靶场网址:http://117.41 ...

  4. 第一次scrum冲刺

     一.第一次冲刺任务          首先分工做好全局规划,然后基于规划实现全部功能,当然现在只是部分.   二.用户故事        用户进入界面    用户输入账号密码        不记得密 ...

  5. web.1

    <!DOCTYPE html><html><head><meta charset="utf-8"> <title>毛哥调 ...

  6. Can DBC 文件翻译,不是很标准,凑合看还可以

    1 引言 DBC文件描述单个CAN网络的通信.这个信息足以监测和分析网络并模拟不是物理可用的节点(剩余的总线模拟). DBC文件也可以用来开发电子控制单元的通信软件,该控制单元应该是CAN网络的一部分 ...

  7. 博客 新址: https://pheromone.github.io/

    该博客暂时调整歇业,小店地址暂时搬迁至: https://pheromone.github.io/ 该博客只做旧文章的维护工作. 博客 新址:  https://pheromone.github.io ...

  8. iOS 10 Programming Fundamentals with Swift 学习笔记 0

    1,a single statement can be broken into multiple lines ,For example, after an opening parenthesis is ...

  9. MYSQL列表中常用语句代码块

    查看数据表是否存在:SHOW TABLES; 显示已经打开的数据库:SELECT DATABASE(); 查看数据表结构:SHOW COLUMNS FROM ***(数据表名): 插入数据:INSER ...

  10. Ubuntu下useradd与adduser区别

    Ubuntu下useradd与adduser有所不同 1.useradd在使用该命令创建用户是不会在/home下自动创建与用户名同名的用户目录,而且不会自动选择shell版本,也没有设置密码,那么这个 ...