foxidrive | 8 Dec 2010 04:58

Re: logs for ftp script

On 8/12/2010 09:57, Abhijat Singh wrote:

> After taking the inputs from Foxidrive, I tried this:
>
> call C:\BATCH\Practice\timestamp.bat
> set log="c:\Batch\Practice\logs\%~nx0_%timestamp%.log"
> if exist file1.txt (
> echo pass>>  %log%
> echo ---------->>  %log%
> ) else (
> echo fail>>  %log%
> echo ---------->>  %log%
> )
>
> the advantage this has over the script I was using earlier (mentioned below) is that I do not have to specify
the file name any more. The disadvantage is that the log file name for the bat file script1.bat is something
like script1.bat_20101207_1744.log. I would typically like to the file name to be script1_20101207_1744.log.
>
> Is there a standard way of achieving that?

change %~nx0 to %~n0

The n gives it the filename and the x adds the extension.

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links
(Continue reading)


Gmane