简体   繁体   English

windows批处理执行关于调用命令

[英]windows batch execute about call command

when i write with batch command using call ,the command is: 当我使用call命令编写批处理命令时,命令是:

call d:\Hot_gen.bat %B_SCRIPT_TARGET% %B_BACKUP_TARGET%>>%logdir%\hot_gen%date:~0,4%%date:~5,2%%date:~8,2%.log

But in the execute the result is: 但在执行中结果是:

C:\Users\Administrator\Desktop\BAT>call d:\Hot_gen.bat d:\ora\scripttar d:\oraba
k\baktar  \hot_gen20131002.log 1>>d:\ora\log
refuse access

Why has the result? 为什么会有结果呢? I just want to >> the call result to log file. 我只想>>将调用结果发送到日志文件。

Thank you! 谢谢!

try this to avoid trailing spaces in %logdir% : 尝试这样做以避免%logdir%尾随空格:

set "logdir=d:\ora\log"
>>"%logdir%\hot_gen%date:~0,4%%date:~5,2%%date:~8,2%.log" call d:\Hot_gen.bat %B_SCRIPT_TARGET% %B_BACKUP_TARGET%

The value of the environment variable logdir has a space at the end. 环境变量logdir的值在logdir有一个空格。

This is most likely because you've got a line somewhere that says 这很可能是因为你在某个地方有一条线说

 set logdir=d:\ora\log

and there's an extra space at the end of the line. 并且在行尾有一个额外的空间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM