troubleshooting Question

Help with a batch file and GOTO sections

Avatar of Simon336697
Simon336697Flag for Australia asked on
Windows Batch
19 Comments2 Solutions505 ViewsLast Modified:
Hi guys hope you are all well and have a fantastic christmas to all of you.
Guys id love your assistance on this one.
I have a large batch file called master.cmd

================================= master.cmd

call test1.cmd

:DRIVEAREA

:EOF



Now, in the following batch file, called test1.cmd, there is a goto section as follows:

GOTO DRIVEAREA


When I run master.cmd, it correctly calls test1.cmd, but when I get to the GOTO section in test1.cmd to go to section DRIVEAREA, which exists in master.cmd, i get an error, saying cannot find batch label specified.

The reason i am doing this is because master.cmd is huge, so i wanted to break it up into chunks of code, leaving the section labels in the code, and putting in GOTO sections referencing the section names that exist in master.cmd in those other files.

Guys, what am i doing wrong?
Is there a way to reference goto sections in master.cmd from other files?

Any help greatly appreciated.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 19 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 19 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros