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. log4j的简介和使用

    一.log4j是什么 引用官网的介绍 Log4j is a fast and flexible framework for logging application debugging messages ...

  2. 使用datepicker和uploadify的冲突解决(IE双击才能打开附件上传对话框)

    在开发的过程当中,IE的兼容无疑是我们的一块绊脚石,在我们使用的如期的datepicker插件和使用上传附件的uploadify插件的时候,两者就产生冲突,只要点击过时间的插件,uploadify上传 ...

  3. FINS/TCP_OMRON(1)

    使用FINS/ TCP与欧姆龙PLC沟通 可参考下列教学 using System.Net; using System.Net.Sockets; 上面必须使用; IPAddress ipAddr = ...

  4. undo系统参数详解

    查看与undo相关的系统参数 1.undo_management 有两个参数值:auto.manual(默认) manual:系统启动后使用rollback segment存储undo信息: auto ...

  5. Linux 操作系统目录结构

    /  根目录 # ls /bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp  var bin - ...

  6. 《多线程操作之生产者消费者》(单生产单消费&多生产多消费)

    说明1:假设有一个放商品的盘子(此盘子只能放下一个商品).生产者每次生产一个商品之后,放到这个盘子里,然后唤醒消费者来消费这个面包.消费者消费完这个商品之后,就唤醒生产者生产下一个商品.前提是,只有盘 ...

  7. [JDBC] 实用性能提升

    在Java以及JavaWeb中,应用的性能是很重要的.尤其是数据库后端对应用的性能影响. 一.使用缓存 性能问题大多数情况下罪魁祸首是访问数据库的那些代码.因为连接到数据库需要准备好连接(connec ...

  8. js date setInterval 时间 时钟 getFullYear ,JavaScript

    js 创建时钟: 1.参考链接:  注意 getYear  (两位 或者 四位) 改成 getFullYear js操作时间 2.实例: html: <span class="glyp ...

  9. contos7 go 环境搭建

    安装包下载地址为:https://golang.org/dl/.(网址打不开请FQ) 根据不同系统,选择对应的安装包: 解压安装 1.下载源码包:go1.10 linux/amd64 2.将下载的源码 ...

  10. npm ERR! Unexpected end of JSON input while parsing near...错误

    问题解决方案在GitHub中: https://github.com/vuejs-templates/webpack/issues/990 总结一下:1.删除package-lock.json 2.进 ...