Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch file not quite running right.

Status
Not open for further replies.

jeffwest21

IS-IT--Management
Apr 4, 2013
60
GB
I have the following in a batch file

Code:
@echo on
setlocal
set LogPath=\\Bridata\user drives\JeffWset LogFileExt=.log
set LogFileName=Daily Backup%LogFileExt%
::use set MyLogFile=%date:~4% instead to remove the day of the week
set MyLogFile=%date%
set MyLogFile=%MyLogFile:/=-%
set MyLogFile=%LogPath%%MyLogFile%_%LogFileName%
::Note that the quotes are REQUIRED around %MyLogFIle% in case it contains a space
If NOT Exist "%MyLogFile%" goto:noseparator
Echo.>>"%MyLogFile%"
Echo.===================>>"%MyLogFile%"
:noseparator
echo.%Date% >>"%MyLogFile%"
echo.%Time% >>"%MyLogFile%"
:startbatch

if exist {\\bridata\Master Drive\CCP\Rostrvm\Output\Park_Test\UK\parkbad.csv}
(    
sqlcmd -Q "exec dbo.Park_Output" -S bridevsql01 -d Park
Echo This Has prossessed the files>>"%MyLogFile%"
)else
(
Echo This has Not Processed any files>>"%MyLogFile%"
)

The issue here is two fold

1. It seems to run through ok, but doesn't log the Echo in the logfiles
2. It does both echo commands when it does, don't suppose anyone can see what I have got wrong here.

'Clever boy...'
 
This line looks suspect:

Code:
set LogPath=\\Bridata\user drives\JeffWset LogFileExt=.log

You probably meant:

Code:
set LogPath=\\Bridata\user drives\JeffW 
set LogFileExt=.log
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top