Hi All,
I have a below script bat script "Release_10142014_jobImplist.txtImport" which writes into a log file. But when I execute the script its aborting with spaces in the log file name . How to trim spaces.
Log file name with spaces script is genearating after execution
Release_10142014_jobImplist.txtImport _20141014 _18 _47 _56 .log
Script :
for /F %%i in ("%~f0") do set
SET filename=%~n0
SET CurrentDate=%date:~-4,4%%date:~-10,2%%date:~-7,2%
SET hh=%time:~-11,2%
if %hh%==0 set hh=00
if %hh%==1 set hh=01
if %hh%==2 set hh=02
if %hh%==3 set hh=03
if %hh%==4 set hh=04
if %hh%==5 set hh=05
if %hh%==6 set hh=06
if %hh%==7 set hh=07
if %hh%==8 set hh=08
if %hh%==9 set hh=09
SET mm=%time:~-8,2%
SET ss=%time:~-5,2%
SET logdir=C:\Users\L21113\Desktop\Deployment\INT\Test\Import_Log\
SET underscore=_
SET FileExt=.log
SET LogFileName=%logdir%%filename%%underscore%%CurrentDate%%underscore%%hh%%underscore%%mm%%underscore%%ss%%FileExt%
cd "C:\Program Files\Ascential\DataStage7.5.2\"
echo "Importing the Batch of jobs Started" >> %LogFileName%
Error :
C:\Program Files\Ascential\DataStage7.5.2>echo "Importing the Batch of jobs S
tarted" Release_10142014_jobImplist.txtImport _20141014 _18 _47 _56 .log 1>>
C:\Users\M29093\Desktop\Deployment\INT\Test\Import_Log\
The system cannot find the path specified.
Thanks,
Somaraju
How to trim spaces
Moderator: DosItHelp
Re: How to trim spaces
There is a lot SHORTER ways to get the date and time into variable then what you are doing. And you made the cardinal sin of not putting quotes around your file paths.
I bet if you searched the forums and looked at a few posts you would find your answers.
I bet if you searched the forums and looked at a few posts you would find your answers.
Re: How to trim spaces
My problem got solved after placing parameters and values in quotes. Thanks for the help