How do I open a Notepad text file with my batch file?

Attached is my batch file (in .txt because EE won't accept .bat).  It will open the first text file, but then wait for me to close it before opening the second...

How do I fix my script so that it opens both Notepad text files instead of waiting for me to close the first one before opening the second?
Open-Logs.txt
LVL 1
shaolinfunkAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Try the following:

@Echo ON

SET YEAR=%date:~10,4%
SET MONTH=%date:~4,2%
SET DAY=%date:~7,2%

Copy NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%P.txt"
Copy NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%E.txt"

START "" NOTEPAD.EXE "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%P.txt"
START "" NOTEPAD.EXE "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%E.txt"
 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
Hi,

Use START "" in front.  That starts a new process for the notepad.exe rather than waiting for it to finish.  If you want the first to start, then the second and the batch to wait leave the START "" off the second.  The "" is the window title so just leave it at "".

hth

Steve

@Echo ON

SET YEAR=%date:~10,4%
SET MONTH=%date:~4,2%
SET DAY=%date:~7,2%

Copy NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%P.txt"
Copy NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%E.txt"

START "" NOTEPAD.EXE "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%P.txt"
START "" NOTEPAD.EXE "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%E.txt"
 
0
Steve KnightIT ConsultancyCommented:
Damn tha explanation I typed :-)
0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

Bill PrewCommented:
You can explore the syntax and options of the START command further with START /?.  In it's default mode it will start the program you tell it, and not wait for it to finish before continuing on with the BAT file.

~bp
0
Steve KnightIT ConsultancyCommented:
BTW Would sugest you use %userprofile% instead of :\\Documents and Settings\Administrator\, i.e.

START "" NOTEPAD.EXE "%userprofile%\Desktop\Logs\%YEAR%-%MONTH%-%DAY%E.txt"

Steve
0
Bill PrewCommented:
Finally, it's been days, no weeks, since I beat Steve on the trigger.  Darn mobile experts!  :-)

~bp
0
Bill PrewCommented:
I also notice that you have an extra backslash in these lines:

Copy NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%P.txt"
Copy NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%YEAR%-%MONTH%-%DAY%E.txt"

Steve's comment about leveraging the %userprofile% environment variable is a good one too, as long as our assumption that you are logged in as the local Administrator is valid.

~bp
0
Steve KnightIT ConsultancyCommented:
Sorry Bill, not actually here much, we must just clash time wise..... not sure I even want to be "Sage" or even what one is apart from something you have with Onions... but something is making me keep trying!
0
Bill PrewCommented:
Goals are important little motivators, even the somewhat "meaningless" ones...

~bp
0
Bill PrewCommented:
Just as a suggestion, here's a slightly leaner version...

@ECHO ON

SET YEAR=%date:~10,4%
SET MONTH=%date:~4,2%
SET DAY=%date:~7,2%
SET STAMP=%YEAR%-%MONTH%-%DAY%

FOR %%A IN (P E) DO (
  COPY NUL "c:\\Documents and Settings\Administrator\Desktop\Logs\%STAMP%%%A.txt"
  START "" NOTEPAD.EXE "c:\\Documents and Settings\Administrator\Desktop\Logs\%STAMP%%%A.txt"
)
0
shaolinfunkAuthor Commented:
that does the trick, thanks!
0
pitonsCommented:
Hi
Put both notepad's on one line and add "|" between them
add "start /b before every notepad.exe

see attach

and there you go!
Open-Logs-edited-.txt
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.