Adding date to the output file's name

Started by Ari

Ari

Adding date to the output file's name   12 February 2014, 22:06

Hi Andrew,

Small question
I created a batch file to automate the netscanner by using windows schedule task. Now the problem is that i would like to have the date in the output file. I found the command and if i type it manually in the command file it works great:
start /wait netscan.exe /config:D:\Tools\Netscan\test.xml /auto:D:\Logs\Netscan\date_%yyyy%%mm%%dd%.xml
Output file:
date_20140212

If i start the command by using batch i get on the output file without the date:
date_

did i miss something?

Thanks for help.

Regards
Ari
SoftPerfect Support forum - Andrew avatar image

Re: Adding date to the output file's name   13 February 2014, 09:59

Hi Ari,

This is because the percent signs are stripped from a batch file text and are treated as environment variables.

In a batch file, you need to double the percent signs
/auto:D:\Logs\Netscan\date_%%yyyy%%%%mm%%%%dd%%.xml
Ari

Re: Adding date to the output file's name   13 February 2014, 18:49

Hi Andrew,

thanks a lot that works perfect!

regards,

Ari

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Email:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

  ******          **  **    **  **     **  **    ** 
 **    **         **   **  **   **     **  ***   ** 
 **               **    ****    **     **  ****  ** 
 **   ****        **     **     **     **  ** ** ** 
 **    **   **    **     **     **     **  **  **** 
 **    **   **    **     **     **     **  **   *** 
  ******     ******      **      *******   **    ** 

Message: