How to add a date suffix to the log file name

In Windows, I want to run certain commands and save the output to a logfile every day. How to add a suffix to the log file name so I can distinguish which log file for which day?
e.g. cmd >> logfile.date

AZ wrote:
In Windows, I want to run certain commands and save the output to a logfile every day. How to add a suffix to the log file name so I can distinguish which log file for which day?
e.g. cmd >> logfile.datemy best friend name is "google", refer to this [url | http://stackoverflow.com/questions/203090/how-to-get-current-datetime-on-windows-command-line-in-a-suitable-format-for-usi]
This is what i did
1) created a dummy file in c drive
2) copy pasted below lines, you can play around more with the format
set _my_datetime=%date%_%time%
set _my_datetime=%_my_datetime: =_%
set _my_datetime=%_my_datetime::=%
set _my_datetime=%_my_datetime:/=_%
set _my_datetime=%_my_datetime:.=_%3) Rename the file from dos
ren some.txt dummy_file_%_my_datetime%.txt4) Here goes the output
C:\dir
dummy_file_Mon_09_20_2010_161347_21.txt
Most of the code i copied from above url, you can tweak a little bit based on ur requirement and format.
Regards
Learner                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How to Append date time to the Source File Name in send Port without Orchestration

    Hi,
    I am using the Macro %SourceFileName%_%datetime%.zip in the filename(Send Port).
    say my file name is ABC.zip
    But I am getting the output as ABC.zip_2013T083444
    Please suggest, How to avoid the extension?
    Vignesh S ----------------------------------------------------------- Please use Mark as Answer if my post has solved your problem and use Vote As Helpful if my post was useful.

    The problem here is %SourceFileName% context property would return filename “With” extension. So when you use %SourceFileName%_%datetime%.zip you get FileNameWithExtension_Datetime
    For this you have to handle it either in customer pipeline component or in orceshtration where you have to remove the extension from the Filename.
    Read this post on remove the extension from this file name
    msgOut(FILE.ReceivedFileName) = System.IO.Path.GetFileNameWithoutExtension(msgIn(FILE.ReceivedFileName));
    After this if you use the
    %SourceFileName%_%datetime%.zip macro, you would get the desired output.
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

  • How to add process model results to the sequence file results?

    After my sequence file runs, I would like to add some additional results using the process model. I need to log my equipment list which is obtained by the process model. Alternatively, I could add a sub-sequence to the end of each of my sequence files for doing this, but that would create maintenance problems if I ever needed to change the way equipment is logged. Does anyone know a way to (1) append process model results to the sequence file results or (2) force each client sequence file to call a sub-sequence before returning to the process model.

    Mark -
    The report and database process model routines expect a single subsequence step result that invoked MainSequence. This result contains the results from the sequence call.
    In TestStand after the process model root sequence call to MainSequence is performed, the property Locals.ResultList[0] is the MainSequence result. The subproperty Locals.ResultList[0].TS.SequenceCall.ResultList contains the results from the steps in MainSequence.
    One option is to create a subsequence call in the process model that logs the equipment info in the results for its steps. The call to the subsequence should not be checked to record results.
    This subsequence would have a parameter called ResultList. The Result type does not exist in the Insert menu, so you can only create the parameter by copying the empty Locals.ResultList and pasting it in the parameters. Then change its type from By Value to By Reference.
    In the setup of the subsequence, add the following steps which do not record results. These steps rename the Locals.ResultList parameter to ResultListOrig, and then create a new Locals.ResultList alias property that really references Parameters.ResultList. This way any additions to the Locals.ResultList really append to the Parameter.ResultList.
    Setup
    Step: "Rename Locals.ResultList"
    StepType, Adapter: Action, Active-X
    Description:
    Action, Set PropertyObject.Name = "ResultListORIG"
    Record Results: False
    Step: "Create Alias in Locals"
    StepType, Adapter: Actioin, Active-X
    Description:
    Action, Call PropertyObject.SetPropertyObject ("ResultList",
    0x201 ' Not Owning and Create, Parameters.ResultList)
    Record Results: False
    In the Main steps, you add your equipment info steps which record results.
    In the Cleanup steps you undo the steps performed in Setup.
    Cleanup
    Step: "Delete Alias in Locals"
    StepType, Adapter: Action, Active-X
    Description:
    Action, Call PropertyObject.DeleteSubProperty ("ResultList",
    0x400 ' Refer to Alias)
    Record Results: False
    Step: "Rename Locals.ResultListORIG"
    StepType, Adapter: Action, Active-X
    Description:
    Action, Set PropertyObject.Name = "ResultList"
    Record Results: False
    I have attached a TS 2.0 version of SequentialModel.Seq that has a AppendResults subsequence in it and this is invoked after MainSequence in Single Pass entry point.
    Hope this helps...
    Scott Richardson (NI)
    Scott Richardson
    National Instruments
    Attachments:
    SequentialModel.Seq ‏174 KB

  • Different log file name in the Control file of SQL Loader

    Dear all,
    I get every day 3 log files with ftp from a Solaris Server to a Windows 2000 Server machine. In this Windows machine, we have an Oracle Database 9.2. These log files are in the following format: in<date>.log i.e. in20070429.log.
    I would like to load this log file's data to an Oracle table every day and I would like to use SQL Loader for this job.
    The problem is that the log file name is different every day.
    How can I give this variable log file name in the Control file, which is used for the SQL Loader?
    file.ctl
    LOAD DATA
    INFILE 'D:\gbal\in<date>.log'
    APPEND INTO TABLE CHAT_SL
    FIELDS TERMINATED BY WHITESPACE
    TRAILING NULLCOLS
    (SL1 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
    SL2 char,
    SL3 DATE "Mon DD, YYYY HH:MI:SS FF3AM",
    SL4 char,
    SL5 char,
    SL6 char,
    SL7 char,
    SL8 char,
    SL9 char,
    SL10 char,
    SL11 char,
    SL12 char,
    SL13 char,
    SL14 char,
    SL15 char)
    Do you have any better idea about this issue?
    I thought of renaming the log file to an instant name, such as in.log, but how can I distinguish the desired log file, from the other two?
    Thank you very much in advance.
    Giorgos Baliotis

    I don't have a direct solution for your problem.
    However if you invoke the SQL loader from an Oracle stored procedure, it is possible to dynamically set control\log file.
    # Grant previleges to the user to execute command prompt statements
    BEGIN
    dbms_java.grant_permission('bc4186ol','java.io.FilePermission','C:\windows\system32\cmd.exe','execute');
    END;
    * Procedure to execute Operating system commands using PL\SQL(Oracle script making use of Java packages
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    finalCommand = new String[4];
    finalCommand[0] = "C:\\windows\\system32\\cmd.exe";
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    new Thread(new Runnable() {
    public void run() {
    try {
    BufferedReader br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println("Process out :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    catch (IOException ioe) {
    System.out.println("Exception caught printing process output.");
    ioe.printStackTrace();
    }).start();
    new Thread(new Runnable() {
    public void run() {
    try {
    BufferedReader br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println("Process err :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    catch (IOException ioe) {
    System.out.println("Exception caught printing process error.");
    ioe.printStackTrace();
    }).start();
    catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    public static boolean isWindows() {
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
    return true;
    else
    return false;
    * Oracle wrapper to call the above procedure
    CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    * Now invoke the procedure with an operating system command(Execyte SQL-loader)
    * The execution of script would ensure the Prod mapping data file is loaded to PROD_5005_710_MAP table
    * Change the control\log\discard\bad files as apropriate
    BEGIN
    Host_Command (p_command => 'sqlldr system/tiburon@orcl control=C:\anupama\emp_join'||1||'.ctl log=C:\anupama\ond_lists.log');
    END;Does that help you?
    Regards,
    Bhagat

  • When using wusa.exe to install MSU update package and enabling logging using the /log switch, what format are the log files in?

    I have been installing a number of hotfixes for Windows 7 using MSU files and the wusa.exe utility included in Windows. I thought it would be a good idea to generate separate log files for each update as it was installed since wusa.exe now supports this
    option using /log:<file name>. However, the log files created do not seem to be regular text files or any other log file format that I immediately recognize. When opened in Notepad or Wordpad you can see that they contain a lot of additional binary data
    which can't be read by a regular text viewer.
    Does anyone know what format these log files are in? What tool should you use to read them?

    I have been installing a number of hotfixes for Windows 7 using MSU files and the wusa.exe utility included in Windows. I thought it would be a good idea to generate separate log files for each update as it was installed since wusa.exe now supports this
    option using /log:<file name>. However, the log files created do not seem to be regular text files or any other log file format that I immediately recognize. When opened in Notepad or Wordpad you can see that they contain a lot of additional binary data
    which can't be read by a regular text viewer.
    Does anyone know what format these log files are in? What tool should you use to read them?
    Only Microsoft can manage to design something as stupid as this. If you start wusa from the command line, it pops up the alternative command line switches. For log, it just says: " /log     - installer will enable logging". It doesn't say that you
    should specify the log file name, hence not HOW you specify it (" /log:<path\filename>.") It doesn't say what extension to use for the file, alas which file type it is (" /log:<path\filename.evtx>."). You open it in notepad, you cannot read it.
    You open it in sccm's cmtrace.exe/trace32.exe, you get nothing. IT IS NOT POSSIBLE TO IMPLEMENT THIS IN A WORSE WAY. How can something be so bad? How can Microsoft get such stupidity inhouse, when you need to go through six interviews or something to get in??
    I cannot believe it - unfortunely, this is seen again and again. 

  • Getting the log files from client using java program

    hi
    this is lalita...and i am doing a project in networking.... i am new to socket programming....i have established the socket connection between the client and server...with this site members' help....now i have to get the log files of the client system from the server.... via the created socket....i need it by tomorrow...i.e apr 12th ....as i have to show it to my guide...
    i just need a core java program that will get the log information of the client from the server......
    Can anybody please help me in this regard..... it would be of great help to me and my group....
    Anxiously awaiting for the replies....
    Thanking you and regards...
    Lalita.

    Simple.
    Server is listening on a specific port for the connection from the clients.
    Connect the client with the server on the above mentioned port.
    Open the streams on both side for the connection and run in separate thread.
    Define a protocol for communication between client and server.
    e.g after connection with the server the server send a text message to the client (send log) now the client first should the log file name and size to the sever and then send the file. the server should save the file.
    then disconnect the client or want to get another file or for other tasks define the other commands

  • How to add A single row at the middle of the table in a Webi report

    Hi,
         I created a Webi report using Universe(Created universe using bex query).Now i have a requirement to display a row at the middle of a report. Can you please tell me ,how to add a sigle row at the middle of a Webi report.
                                                    Thanks in advance
    Regards
    Monika

    Hi Monika,
    It is not really possible to add a row (I assume you mean of unrelated data) to the middle of a table in a report. You can add a new table with a single row between two tables. For instance you could add a new one row table, or even single cells which are positioned relatively between two tables. Possibly a block on top of another. But this gets tricky.
    Can you explain in more detail what you are trying to do?
    Thanks

  • How to add a excel driver in the Adminstrator tools

    how to add a excel driver in the adminstrator tools > odbc Datasource,
    I have to add the name and excel sheet location in the SystemDsn but whiling finishing the stups i will get the error like
    error found could not found the registery.
    ,So is there any other setting is required while i am adding in the excel driver
    please help me out for this ,this is 1st time am using the excel source in the report data source..

    I'd ask them over here.
    Windows forums on Microsoft Answers
    Office Excel forums on Micrsoft Answers
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • How to add one date column and charecter column

    hi all,
    i have 3 column start_date(date),end_date( date),duration (varchar2)
    i am trying to add start_time and duration like this
    end_date := to_char(start_time) + duration;
    but its showing value_error
    how to add one date column and charecter column.
    Thanks

    you need something that does:
    end_date (DATE) := start_date (DATE) + <number of
    days> (NUMBER)Not necessarily, because if the duration is just a string representation of a number then it will be implicitly converted to a number and not cause an error
    e.g.
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select to_date('01/07/2007','DD/MM/YYYY') as start_dt, '3' as duration_days from dual)
      2  -- END OF TEST DATA
      3  select start_dt + duration_days
      4* from t
    SQL> /
    START_DT+
    04-JUL-07

  • How to add TIMESTAMP data type in  Enterprise Architect...?

    Hi all
    There is no data type of timestamp in Enterprise Architech. There is only
    DATE type. I have ERD prepared from Enterprise Architech. How to modify
    DATE type to TIMESTAMP type.
    How to add TIMESTAMP data type in Enterprise Architect or in ERD ?
    Thanks in advance,
    Pal

    Have you asked this question of the vendor of Enterprise Architect? They may have a later version that supports the various TIMESTAMP data types. If your ERD tool doesn't support a data type, other than talking to the vendor or working around the problem (i.e. generate DDL to a text file and edit it before applying it to the database), you're probably out of luck.
    Justin

  • How to add new data file

    Hi Friends,
    We have 4 below file systems.
    Sybase/TST/sapdata_1
    Sybase/TST/sapdata_2
    Sybase/TST/sapdata_3
    Sybase/TST/sapdata_4
    Already we have added one data file each in sapdata_1 and 2.  Sapdata3 and 4 are emptry.
    How to add new data file in sapdata3 or 4.
    Please provide syntax for creating a new data file and steps for the same.
    Regards,
    Karthik.

    Just for the record: you have here the DBACockpit documentation:
    https://websmp201.sap-ag.de/~form/sapnet?_FRAME=CONTAINER&_OBJECT=011000358700000571562012E
    And this is a sample of the extend to be executed:
    Regards,
    Victoria.

  • Does anyone know how to Add a date drop down list to a pdf file?

    Can someone tell me how to add a Date drop down list in a form

    There's no built-in function that does that in Acrobat, but there are some third-party tools that do.
    The two most known ones are by FormRouter, which is free and based on form fields (but also a bit buggy), and a non-free version created by Max Wyss, which is based on a dialog object.

  • How to print the report file name and path and the last mod date

    Good morning,
    I am trying to print on the footer of the report the report file name and path as well as the report last modification date.
    Anyone would know how I can do that? I have checked the doc but found nothing.
    Thks. Philippe.

    Did you ever determine how to print report name and report last mod date?
    Thanks

  • How can I import data in to the digital word generator in Multisim?

    How can I import data in to the digital word generator in Multisim?
    I just  received this comment from a friend, a RADAR engineer, who has just down loaded Multisim.  He has been using HP/Agilent software.  He has a work around using a piecewise linear voltage waveform with data imported from Excel but this is not really a good solution.  It would also be helpful to import data from Mathcad or equivalent.
    "I thought I was about to be impressed with MultiSim but it ended only in disappointment. There is a word generator in the simulation instrument panel which can drive the DAC with a waveform and it can have thousands of lines of values. I opened Excel, wrote the formula to generate the time and voltage points for a chirp, converted to DAC values in Hex and then went back to the word generator in MultiSim to load the values only to find that you have to enter each value manually. It doesn’t even allow you to paste in a list of values from a text file. I’m not going to type 5000 values by hand. If you get the chance to give feedback to National Instruments please ask them if the paste option can be added to the word generator. MultiSim is useful in many regards, but in this case, it left me with the impression that it is considerably limited in capability compared to what I’m used to."

    Hi,
    You can load your data automatically in the Multisim word generator. Follow these steps:
    - Save your data file (in excel .xslx ir .csv format) on your computer
    - Change the extension of the file to ".dp"
    - Double-click the word generator in Multisim and click on Set...
    - In the Settings dialog box, click on Load and then Accept
    - This will prompt you to select the .dp file you have on your computer, select it and you're good to go
    However, in Multisim you have the option of creating your own custom simulation analysis and instrument.
    I will try creating the instrument and send it back to you but it might take some time.
    Multisim and LabVIEW are very powerful in test automation, with the custom instruments you create for Multisim you don't need to export your data file into excel from LabVIEW (or MathCAD or other tools) and then reload it into Multisim. The test procedure is automated instead.
    Please check this reference design about automated simulation
    http://zone.ni.com/devzone/cda/tut/p/id/7825
    Here is how you can create your own custom measurement tool in Multisim and LabVIEW, but as I mentioned, I will create the word generator and come back to you anyways
    http://zone.ni.com/devzone/cda/tut/p/id/5635
    Let me know if you have any questions.
    Mahmoud W
    National Instruments

  • How to add a radio station to the library

    just loaded itunes 6 (windows box) and can't find out how to add a radio station to the library

    If your current stations in WMP are .pls or .m3u URL's, they may work in iTunes also. Use the "Open Stream" command from the Advanced menu and put in the URL that includes .pls/.m3u. If the URL is a .mwv variety, those are Windows proprietary format and not supported by iTunes. Same with .ra streams (Real Audio).
    .pls & .m3u usually indicate MP3 based streams supported in iTunes. It's up to the original radio station/streaming site to select the format and make it available. Shoutcast.com & Live365.com are great resources for mp3 based streams.

Maybe you are looking for

  • HT1349 i did the update to my i pad and it said error 1604 now it wont charge so i cant turn it on

    hi i plugged in my i pod the other day to my computer and im running xp with the original ipad it did the update now it wont charge error 1604

  • Error in test configuration -URJENT

    Hello every one,                 here i am facing a serious issue from last 5 days. which i am not able to find it where the problem is?.                the issue is here our scenario is file to R/3. actually on the sender side we created one structu

  • ALV BLOCK REPORT

    please tell me the process how to create ALV block report with simple example

  • Trying to Reinstall AFTER a crash

    my computer froze for about 1 hour i had to restart then i got the folder w/? , shut it back down ran disk worrier three time's then it still starts w/ the ? on the folder then after 25 min it finally gets to my desk top but very slow, everything i d

  • Transfering SIM Card data to new phone?

    Hi, I was wondering if my SIM card holds all my addressbook data? I have just purchased a 6085 and want to transfer the data from my 6061 to my new phone. Will it all be in my SIM card or do I have to re-enter the contents of my old phone data manual