Command line tokens for day, year, month, hour, minute don't work

Started by Matthew Fletcher

Per the online guide:

"It is also possible to have the current date and time in the file name. Use any combination of the following tokens, each enclosed between two percent signs: y, yy, yyyy, m, mm, mmm, mmmm, d, dd, ddd, dddd, h, hh, n, nn, s, ss. For example, date_%yyyy%%mm%%dd%_time_%hh%%nn%.csv."

However this doesn't seem to work at all for me. Example I tried:
netscan.exe /auto:"Testing_%mm%-%dd%-%yyyy%_scan.txt" /load:"myfile-Default.xml"

Any suggestions??

I tried with and without quotes, single quotes, double % signs also no good... I tried with and without extra space between /auto: and /load:, and without extra space nothing works, its like the token doesn't get replaced when saving to file with correct value.
Solution found:

You must make sure the tokens aren't in quotes, and that its two percent signs before and after each token, else it doesn't work with a single percent sign.
If you need a space, it must be in the quotes like below where there's a blank space after 0737 for the filename in the subdirectory of 0737:
netscan.exe /auto:"0737\0737 "%%mm%%-%%dd%%-%%yyyy%%".txt"

this won't work:
netscan.exe /auto:0737\0737 %%mm%%-%%dd%%-%%yyyy%%".txt"

this will without the space:
netscan.exe /auto:0737\0737%%mm%%-%%dd%%-%%yyyy%%".txt"

Hope this helps someone else!
SoftPerfect Support forum - Andrew avatar image

Re: Command Line tokens for day, year, month, hour, minute don't work   19 March 2015, 14:05

Hi Matthew, thanks for posting your observations.

It's not a bug however, but the default behaviour of the Windows shell if you launch netscan.exe from a batch file or a command prompt.

So yes, for any % sign you need to pass to a program, you have to double it. Here is more info about escaping special characters.

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: