[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Using batch file to save files with date and time stamp

Asked by mhorner0224 in MS DOS, Windows Batch Scripting

Tags: batch file, command prompt, date, time

I am trying to create a text file using a batch file. I format the text file then open it for the user to make entries into. I want to save the file name as follows.

computername_InstallerName_Install_Log_Date_Time.txt

I have tried a number of ways and it seems to save it and while I may get the name to work when I go to open it it does not find it. Is that because it is always looking for the current time where my time does not match it?

Can this be done or am I trying to do the impossible?

I appreciate all suggestions.

Marcus
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
FOR %%i IN (C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\Programs_R.here SET varDriveLetter=%%i:
:STEP1
	echo.
	echo.
	echo  Enter your name without a space in the middle.
	echo. Use this format: Marcus_Horner
	echo.
	echo.
	set /p installer=     What is your First and Last name?  
        echo.
        echo.
        set /p varGL=    What is this stores 4-digit GL# ?  
	cls
	echo.
	echo.
	@echo off
:MYVARIABLES
        SET varnewDate=%date%
	SET varnewTime=%time%
	set dude=%computername%_%installer%
	SET varroot=cd /d %varDriveLetter%\
	SET varpath=cd Installation_Files\Computer-Rx\Phase1\
	SET varPrograms= %varroot%Installation_Files\Computer-Rx\Phase1\Programs\
	SET varSaveFile="c:\Installation_Files\Logs\%dude%_Phase1_Log_%varnewDate%_%varnewTime%.txt""
	SET incident="c:\Installation_Files\Logs\%dude%_Phase1_Incident_Report.txt"
        SET varMailman= %varroot%Installation_Files\MailMan\
        SET varNOTsigned="c:\Installation_Files\Logs\%dude%_Phase1_Installer_Agreement_NOT_Signed.txt"
	SET varSigned="c:\Installation_Files\Logs\%dude%_Phase1_Agreement_Signed.txt"
 
:FILECREATION
:STEP2	
echo     ____________________________________________________________________
echo                         Automated Script written for 
echo               Computer-RX Installations by Marcus Horner 2009 
echo                         Server 2008 Image Preparation
echo     ____________________________________________________________________
echo.
	echo.
	IF exist %varSigned% GOTO AGREED
	cls
	echo.
	echo.
	echo  Welcome %installer%. I hope you are having a nice day.
	echo.
	echo.
	echo  This program is an installation and functions as the installer's 
	echo.
	echo  digital checklist for verifying they have installed and configured 
	echo.
	echo  the various tasks presented in the Server 2008 Image Preparation.
	echo.
	echo.
	echo  By agreeing to these terms you are signing off that you will have 
	echo.
	echo  completed all steps in this installation and verified them for accuracy.
	echo. 
	set /p agree= Do you agree to this? (Y) Yes  (N) No  
	echo.
        IF /i "%agree%" == "Y" GOTO AGREED
        IF /i "%agree%" == "N" GOTO DOESNOTAGREE
:DOESNOTAGREE:
        @echo off
        cls
        echo.
        echo.
        echo  Well %user% that is unfortuntate. Please explain why you refuse to
        echo  accept the installer's user agreement.
        echo.
        echo.
        echo  I will open a file for your to report your reasons.
        echo.
        echo.
        echo. When finished simply save and close the file.
        date /t >> %varNOTsigned%
        time /t >> %varNOTsigned%
        echo               USA Drug IT Department Digital Installation Form >> %varNOTsigned%
	echo. >> %varSaveFile%
        echo. >> %varNOTsigned%
	echo %installer% has chosen not to sign their digital signature for %computername% Phase 2 Server 2008 C-Rx Installation for the following reasons. >> %varNOTsigned%
        echo. >> %varNOTsigned%
        echo. >> %varNOTsigned%
        echo  Reasons... >> %varNOTsigned%
        echo. >> %varNOTsigned%
        notepad.exe %varNOTsigned%
	echo. >> %varNOTsigned%
        echo. >> %varNOTsigned%
        echo  Signed: %user%
	%varMailman%
        echo. >> %varNOTsigned%
	sendemail.exe -u "%dude% Phase 2 Installer Agreement Issue" -t "mhorner@usadrug.com" -f "%installer% <installer@usadrug.com>" -o message-file="%varNOTsigned%" -s "email.usadrug.local" -a "%varNOTsigned%"
        pause
	cls
        echo.
        echo.
        echo  This program will now close.
        @echo off
        ping 127.0.0.1 >>junk
        del junk
        exit
[+][-]09/01/09 09:00 AM, ID: 25232929Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: MS DOS, Windows Batch Scripting
Tags: batch file, command prompt, date, time
Sign Up Now!
Solution Provided By: t0t0
Participating Experts: 2
Solution Grade: A
 
[+][-]09/01/09 10:00 AM, ID: 25233566Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/01/09 10:41 AM, ID: 25233936Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/01/09 12:03 PM, ID: 25234816Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/06/09 06:07 AM, ID: 25269654Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/06/09 09:21 AM, ID: 25270483Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/06/09 09:43 AM, ID: 25270568Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/06/09 10:13 AM, ID: 25270670Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09/06/09 11:48 AM, ID: 25271015Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09/06/09 11:51 AM, ID: 25271028Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09/06/09 11:54 AM, ID: 25271036Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-89 - Hierarchy / EE_QW_3_20080625