Saved Bookmarks
| 1. |
Solve : Save file with current DateTimestamp? |
|
Answer» I'm using batch file to run Visual Studio load test. For this I'm using MSTest command's /testcontainer and /resultsfile METHODS. I want to save file with unique name by appending datetimestamp to output file specified in /resultsfile method. How can I do so? I'm using batch file to run Visual Studio load test. For this I'm using MSTest command's /testcontainer and /resultsfile methods. I want to save file with unique name by appending datetimestamp to output file specified in /resultsfile method. How can I do so? download GNU coreutils, then try this Code: [Select]echo off for /F %%a in ('gnu_date.exe +%%m-%%d-%%Y-%%H_%%M_%%S') do ( set timestamp=%%a ) set filename=c:\TestResults-%timestamp%.trx MSTest /testcontainer:"C:\Test.loadtest" /resultsfile:%filename% or, just Code: [Select]MSTest /testcontainer:"C:\Test.loadtest" /resultsfile:"C:\TestResults%date%-%time%.trx" ghostdog74 and BC_Programmer, received MSTest syntax error in both ways.if the date and/or time variables contain poison characters you have to remove or replace these before trying to use them in a file name.This may be helpful: Code: [Select]echo off for /f "tokens=2-7 delims=./: " %%i in ("%date% %time%") do ( set mm=%%i set dd=%%J set yyyy=%%k set hh=%%l set mn=%%m set ss=%%n ) MSTest /testcontainer:"C:\Test.loadtest" /resultsfile:TestResults_%mm%-%dd%-%yyyy%-%hh%_%mn%_%ss%.trx If your date format is not mm/dd/yyyy, you'll need to reconfigure the set statements. Quote from: goru09 on April 12, 2010, 11:37:42 AM ghostdog74 and BC_Programmer, received MSTest syntax error in both ways.Then check your DOCUMENTATION on MSTest for the correct syntax.Thanks Sidewinder! |
|