ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20170425]变态的windows批处理1.txt

[20170425]变态的windows批处理1.txt

Linux操作系统 作者:lfree 时间:2017-04-25 15:11:35 0 删除 编辑

[20170425]变态的windows批处理1.txt

--//最近一段时间写批处理,遇到一个古怪的问题,例子:
C> cat a.bat
echo @echo on > d:\aa.bat
echo echo  start sync file from usb >> d:\aa.bat
echo h: >> d:\aa.bat
echo cd \blog >> d:\aa.bat
...
pause

C:\Users\Administrator\Desktop\bat>echo @echo on  1>d:\aa.bat
C:\Users\Administrator\Desktop\bat>echo echo  start sync file from usb  1>>d:\aa.bat
另一个程序正在使用此文件,进程无法访问。

--//开始感觉很奇怪,为什么出现"另一个程序正在使用此文件,进程无法访问。"情况呢?而且出现位置不一样。

R:\>xx
R:\>echo @echo on  1>d:\aa.bat
R:\>echo echo  start sync file from usb  1>>d:\aa.bat
R:\>echo h:  1>>d:\aa.bat
R:\>echo cd \blog  1>>d:\aa.bat
R:\>echo D:\tools\linux\usr\local\wbin\date "+%%T"   1>>d:\aa.bat
R:\>pause
请按任意键继续. . .
--//这次没有出现,而第2次出现。

R:\>xx
R:\>echo @echo on  1>d:\aa.bat
R:\>echo echo  start sync file from usb  1>>d:\aa.bat
另一个程序正在使用此文件,进程无法访问。
R:\>echo h:  1>>d:\aa.bat
R:\>echo cd \blog  1>>d:\aa.bat
R:\>echo D:\tools\linux\usr\local\wbin\date "+%%T"   1>>d:\aa.bat
R:\>pause
请按任意键继续. . .

--//没有办法只能在每次输出后,认为加入一条sleep 1语句。(注这个版本不支持sleep 0.1这样的方式)
--//sleep 来自unxutil的安装包,大家可以自行下载。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2137952/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7970380