| 1. |
Solve : Good morning / Good afternoon display in BAT? |
|
Answer» Hello, Hello,for /f "delims=:" %A in ("%time%") do if %A LSS 12 (echo Good morning!) else (echo Good afternoon!)I just added this to the beginning of my BAT and it is not working. It simply closes the CMD windows very quickly. I added pause after it, but it will not stay open. Any ideas?Quote from: TheHoFL on May 28, 2009, 04:57:55 PM I just added this to the beginning of my BAT and it is not working. It simply closes the CMD windows very quickly. I added pause after it, but it will not stay open. Any ideas?Sorry...add space between "delims=:" and %A If that doesn't work, run CMD and drag the BATCH file to the window...press enter and see if it displays any messages.Works like a charm! Thank you for your assistance! You are very much appreciated right now! -HoFLQuote from: TheHoFL on May 28, 2009, 05:01:41 PM Works like a charm! Thank you for your assistance! You are very much appreciated right now!No problem! Feel free to stick around and help out other members, or get help if you need it!I am always looking for people to help. I am somewhat new to some of the commands used in BAT files. I pretty much used to make them when i needed them and then stop. I am trying to take the time to learn now though. Quote from: TheHoFL on May 28, 2009, 05:04:47 PM I am always looking for people to help. I am somewhat new to some of the commands used in BAT files. I pretty much used to make them when i needed them and then stop. I am trying to take the time to learn now though.That's great! Batch is extremely easy to learn, a bit difficult to master, but is so usefull for organizing files/folders or automating tasks!Check this out, you will find it awesome! ... Code: [Select]@echo off for /f "tokens=2*" %%a in ('net user "%Username%" /domain ^| find /i "Full Name"') do SET DisplayName=%%b for /f "delims=:" %%A in ("%time%") do if %%A LSS 12 (echo Good morning and welcome %DisplayName%) else (echo Good afternoon and welcome %DisplayName%) echo. ECHO You are currently signing on to %COMPUTERNAME% echo. ECHO Please wait while authenticating %username% with the %USERDOMAIN% domain. echo. pause echo on Very nice! I SAVED that one in my bat folder. I really like the idea too. Thanks for starting this topic, and thanks to Helpmeh for the solution. Quote from: TheHoFL on May 28, 2009, 05:11:02 PM Check this out, you will find it awesome! ...Quote System error 1355 has occurred.Note, %userdomain%==%computername% and %computername% NEQ %username%... Just putting that out there...Hmm... Are you connected to an AD domain? This seems to work for me... Quote from: TheHoFL on May 28, 2009, 05:20:20 PM Hmm... Are you connected to an AD domain? This seems to work for me...To an what?Just ran it right now. This is what i got. I changed the credentials and information, but this is what came up. Because i am joined to a domain the domain is not the PC name... fyi... Quote Good afternoon and welcome Michael LASTNAMEOh and AD is Active Directory. fyi...http://en.wikipedia.org/wiki/Active_Directory |
|