Highlighted
Contributor

Export batch script | Capture Current Date & time append with file name

@Misbah 

Hi Flok,

 

How to modified export script to get the customize file name along with current date & time 

 

Regards,

Rahul

2 REPLIES 2
Highlighted
Contributor

Re: Export batch script | Capture Current Date & time append with file name

 

@xrprasadx 

Generally, the solution is quite simple — we should use the %date% and %time% built-in variables, that display date and time based on the regional coding. 

  • for date
    echo %date%

  • for time
    echo %time%

    just add in front of output file name in connect script for example - "D:\path\outfile_%date%%time%"

Hope it Helps!

Highlighted
Contributor

Re: Export batch script | Capture Current Date & time append with file name

Thanks but below is the working script

============================

set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
set sec=%time:~6,2%
if "%sec:~0,1%" == " " set secs=0%secs:~1,1%
set filename=D:\outfile_%date:~10,4%%date:~7,2%%date:~4,2%_%hour%%min%%sec%.csv%
set Operation=-service "https://api.anaplan.com" -auth "https://auth.anaplan.com" -export "ExportName" -execute -get %filename%

======================================================================================================