llarava
asked on
Need help with a BATCH file
Hi,
Scenario:
-We are using the following batch file which is configured with an AT task.
@echo off
cd C:\Program Files (x86)\JAM Software\TreeSize Professional\
TreeSize.exe /HTML "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR eport.HTML " /EXPAND 2 \\ss1\is_shared
blat.exe "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR eport.HTML " -to email1@domain.com -f storagealerts@domain.com -server exchange.domain.local
-The script runs once every moth
-Through TreeSize.exe /HTML we are creating an output HTML file which creates a report the report is named "IS_SHARED_StorageReport.H TML" and it is placed on network share.
-The report is sent via email to a number of recepients. We use BLAT.EXE + the name of the report to do it.
-The report that is saved on the network share is overwriten every moth since we are using the same name.
Issue:
Since the report is saved on the network share with the same name overwrites the previous one which is now becoming a problem because we don't have any data for trending.
Question:
We are trying to figure out if the is any way to get the batch file modified in order to create a file with a new name. For example something like this:
IS_SHARED_StorageReport_03 /14/2012.H TML
IS_SHARED_StorageReport_04 /14/2012.H TML
IS_SHARED_StorageReport_05 /14/2012.H TML
IS_SHARED_StorageReport_06 /14/2012.H TML
etc.
Could someone help us out with this one?
Thank you!
Scenario:
-We are using the following batch file which is configured with an AT task.
@echo off
cd C:\Program Files (x86)\JAM Software\TreeSize Professional\
TreeSize.exe /HTML "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR
blat.exe "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR
-The script runs once every moth
-Through TreeSize.exe /HTML we are creating an output HTML file which creates a report the report is named "IS_SHARED_StorageReport.H
-The report is sent via email to a number of recepients. We use BLAT.EXE + the name of the report to do it.
-The report that is saved on the network share is overwriten every moth since we are using the same name.
Issue:
Since the report is saved on the network share with the same name overwrites the previous one which is now becoming a problem because we don't have any data for trending.
Question:
We are trying to figure out if the is any way to get the batch file modified in order to create a file with a new name. For example something like this:
IS_SHARED_StorageReport_03
IS_SHARED_StorageReport_04
IS_SHARED_StorageReport_05
IS_SHARED_StorageReport_06
etc.
Could someone help us out with this one?
Thank you!
you can add those line at the begining of the batch :
Set YEAR=%DATE:~10,4%
Set MONTH=%DATE:~4,2%
Set DAY=%DATE:~7,2%
Set CURDATE=%YEAR%-%MONTH%-%DA Y%
then use %CURDATE% in the file name
so your batch will look like this :
@echo off
Set YEAR=%DATE:~10,4%
Set MONTH=%DATE:~4,2%
Set DAY=%DATE:~7,2%
Set CURDATE=%YEAR%-%MONTH%-%DA Y%
cd C:\Program Files (x86)\JAM Software\TreeSize Professional\
TreeSize.exe /HTML "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR eport_%CUR DATE%.HTML " /EXPAND 2 \\ss1\is_shared
blat.exe "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR eport_%CUR DATE%.HTML " -to email1@domain.com -f storagealerts@domain.com -server exchange.domain.local
Set YEAR=%DATE:~10,4%
Set MONTH=%DATE:~4,2%
Set DAY=%DATE:~7,2%
Set CURDATE=%YEAR%-%MONTH%-%DA
then use %CURDATE% in the file name
so your batch will look like this :
@echo off
Set YEAR=%DATE:~10,4%
Set MONTH=%DATE:~4,2%
Set DAY=%DATE:~7,2%
Set CURDATE=%YEAR%-%MONTH%-%DA
cd C:\Program Files (x86)\JAM Software\TreeSize Professional\
TreeSize.exe /HTML "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR
blat.exe "\\ss1\IS_Shared\Weekly Storage Reports\IS_SHARED_StorageR
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
micropc1,
This one seems to work. The only issue is that I think that blat.exe needs a litle time catch up with the HTML file creation. Basically I get an email but it looks like raw code.
Would the script wait until the HTML file is fully generated and then send the email through BLAT.EXE?
This one seems to work. The only issue is that I think that blat.exe needs a litle time catch up with the HTML file creation. Basically I get an email but it looks like raw code.
Would the script wait until the HTML file is fully generated and then send the email through BLAT.EXE?
yes, a batch file is sequential
ASKER
That is what I thought...
Well BLAT says something like this "Failed to open registry key for Blat Profile, using default. Failed to open registry key for blat
Well BLAT says something like this "Failed to open registry key for Blat Profile, using default. Failed to open registry key for blat
You may need to specify that the email is in HTML format. Try using blat's -html parameter to set the encoding to text/html or attaching the html file using -attacht.
Open in new window