Windows batch file
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的更多相关文章
- 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 ...
- Launch a Batch File With Windows Installer
Quote from: http://flexerasoftware.force.com/articles/en_US/HOWTO/Q111515 Synopsis This article desc ...
- 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. ...
- windows batch语法
windows BATCH基本知识扩展名是bat(在nt/2000/xp/2003下也可以是cmd)的文件就是批处理文件. ==== 注 =============================== ...
- 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 ...
- 深入浅出Windows BATCH
1.什么是Windows BATCH BATCH也就是批处理文件,有时简称为BAT,是Windows平台上的一种可运行脚本,与*nix(Linux和Unix)上的Shell脚本和其它的脚本(Perl, ...
- Windows Batch 编程 和 Powershell 编程
Batch Script - Functions with Return Values https://www.tutorialspoint.com/batch_script/batch_script ...
- CCNET+ProGet+Windows Batch搭建全自动的内部包打包和推送及管理平台
所要用的工具: 1.CCNET(用于检测SVN有改动提交时自动构建,并运行nuget的自动打包和推送批处理) 2.ProGet(目前见到最好用的nuget内部包管理平台) 3.Windows Batc ...
- Windows batch,echo到文件不成功,只打印出ECHO is on.
jenkins 执行Windows batch command的时候,如果想要读写文件,echo到文件不成功. bat 代码如下: set ctime=%date%_%time% echo %ctim ...
随机推荐
- shell中的输出重定向
shell中默认有三个标准设备:标准输入(STDIN).标准输出(STDOUT).标准错误(STDERR). 在Linux系统中,一切(或几乎一切)都是文件.因此,标准输入的文件描述符是0,标准输出的 ...
- change事件同一文件多次选中
最近在做图片上传的时候,碰到了一点问题,那就是选择内容相同,change事件执行不了 网上搜索了答案,使用off('change')好像也不行 最终找到一种解决办法 使用replaceWith重置in ...
- Vue语法学习第五课——条件渲染
① v-if .v-else-if .v-else <div v-if="type === 'A'"> A </div> <div v-else-if ...
- 自学python之路(day4)
一 购物车小程序 goods=[{}, {}, {}] shop_car={} li=[] ,len(goods)): li.append(i) money=input('请输入您的总金额:') if ...
- golang对不同系统的编译
Golang 支持在一个平台下生成另一个平台可执行程序的交叉编译功能. Mac下编译 # mac编译linux执行文件 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go ...
- jar包是干什么用的
1.JAR(Java ARchive)是将一系列文件到单个压缩文件里,就象Zip那样.但是,同Java中其他任何东西一样,JAR文件是跨平台的,所以不必关心涉及具体平台的问题.2.jar包就是别人已经 ...
- 花了2小时写bug
程序员的工作,写bug,修bug,改bug 写了2小时逻辑关系,没写明白 比昨天多了一个返回上一层的功能 也很简单,清除下数组内容即可 emm..明天继续深究吧 dic = { "植物&qu ...
- 解决Caused by: java.lang.IllegalArgumentException: A universal match pattern ('/**') is defined before other patterns in the filter chain, causing them to be ignored. Please check the ordering in your
写项目时应用了SpringSecurity框架来进行登陆验证,之前单独的写简单的SpringSecrity的Demo时并没有报错,但是当和SpringMVC一起整合时却发生了报错 报错如下: Caus ...
- C++入门程序作业2
程序在Dev-C++5.5.3版本运行 结构体的使用 给结构体赋值,打印出结构体中学生姓名,分数,平均分 #include <iostream>#include <cassert&g ...
- js 小数取整数
1.丢弃小数部分,保留整数部分 parseInt() 22.127456取成22.13 parseInt(5/2) 2 向上取整,有小数就整数部分加1 Math.ceil(5/2) 3,四舍五入 ...