简体   繁体   中英

windows batch execute about call command

when i write with batch command using call ,the command is:

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% :

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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