Won't write a log file

View: New views
3 Messages — Rating Filter:   Alert me  

Won't write a log file

by Gary Kuznitz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can't figure out why this batch file won't write any log.

  @echo off
  cls
  set SUFFIX=0
  :Defrag
  set /A SUFFIX=SUFFIX + 1
  set FILENAME=DirMS%SUFFIX%.log
  if exist %FILENAME% del %FILENAME% > NUL

  call "C:\Program Files\DefragDirMS\DirMS.exe" c: defrag -q -o "C:\Program
Files\DefragDirMS\%FILENAME% -a "C:\Program Files\DefragDirMS\%FILENAME%
  call "C:\Program Files\DefragDirMS\DirMS.exe" c: move lcn  -o "C:\Program
Files\DefragDirMS\%FILENAME% -a "C:\Program Files\DefragDirMS\%FILENAME%
  call "C:\Program Files\DefragDirMS\DirMS.exe" c: compact -q -o "C:\Program
Files\DefragDirMS\%FILENAME% -a "C:\Program Files\DefragDirMS\%FILENAME%
  GOTO Defrag

(If the line starts in col one the line wrapped)

It isn't creating any file at all.  It should creeate a log.

Thank you,

Gary Kuznitz

Re: Won't write a log file

by Gary Kuznitz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found my answer but I have another question.

On 22 Jan 2009 at 7:15, Gary (Gary Kuznitz <batchworld@...>) commented about [BATCH WORLD] Won't write a log file:

> I can't figure out why this batch file won't write any log.
>
>   @echo off
>   cls
>   set SUFFIX=0
>   :Defrag
>   set /A SUFFIX=SUFFIX + 1
>   set FILENAME=DirMS%SUFFIX%.log
>   if exist %FILENAME% del %FILENAME% > NUL
>
>   call "C:\Program Files\DefragDirMS\DirMS.exe" c: defrag -q -o "C:\Program
> Files\DefragDirMS\%FILENAME% -a "C:\Program Files\DefragDirMS\%FILENAME%
>   call "C:\Program Files\DefragDirMS\DirMS.exe" c: move lcn  -o "C:\Program
> Files\DefragDirMS\%FILENAME% -a "C:\Program Files\DefragDirMS\%FILENAME%
>   call "C:\Program Files\DefragDirMS\DirMS.exe" c: compact -q -o "C:\Program
> Files\DefragDirMS\%FILENAME% -a "C:\Program Files\DefragDirMS\%FILENAME%
>   GOTO Defrag
>
> (If the line starts in col one the line wrapped)
>
I found I was missing quotes:
 call "C:\Program Files\DefragDirMS\DirMS.exe" c: compact -q -o "C:\Program  
Files\DefragDirMS\%FILENAME%" -a "C:\Program Files\DefragDirMS\%FILENAME%"

This produces a log file with a sequence number starting with:
DirMS1.log

I'd like to find out how to  make the sequence number 3 characters?
DirMS001.log
> Thank you,
>
> Gary Kuznitz


Re: Won't write a log file

by foxidrive-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, 22 Jan 2009 08:52:54 -0800, "Gary Kuznitz" <docfxit@...>
wrote:

>>   @echo off
>>   cls
>>   set SUFFIX=0
>>   :Defrag
>>   set /A SUFFIX=SUFFIX + 1
>>   set FILENAME=DirMS%SUFFIX%.log
>>   if exist %FILENAME% del %FILENAME% > NUL

> call "C:\Program Files\DefragDirMS\DirMS.exe" c: compact -q -o "C:\Program  
>Files\DefragDirMS\%FILENAME%" -a "C:\Program Files\DefragDirMS\%FILENAME%"
>
>This produces a log file with a sequence number starting with:
>DirMS1.log
>
>I'd like to find out how to  make the sequence number 3 characters?
>DirMS001.log

Untested:

set /A SUFFIX=SUFFIX + 1
set num=   %suffix%
set num=%num:~-3%
set FILENAME=DirMS%num%.log