How to write a batch file in Windows?

I would like to write a batch file in Windows to run the following commands
xyz.bat -u A \\some\path\in\here\somefileName.bat -v
cd \\to\a\directory\given\as\an\input\to\the\batch\file

xyz.bat -u A \\run\a\perl\file\inhere\fileName -option A -option B

Open in new window

As I mentioned in the sudo code above, the directory that I want to cd to will be given as an input to the batch file.

Also, the following part will also be an input the to batch file:


Open in new window

The options will not be an input. They will be hard coded in the batch file.

so basically the sudo code can also be summarized like this:

xyz.bat -u A \\some\path\in\here\somefileName.bat -v
cd $directory

xyz.bat -u A $file -option A -option B

Open in new window

Can you please tell me how I can write this code?
Who is Participating?
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.

instead of $directory and $file, the parameters come in as %1 and %2.

just use %1 and %2, and the parameters will go in as typed

xyz.bat -u A \\some\path\in\here\somefileName.bat -v
cd %1

xyz.bat -u A %2 -option A -option B

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
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

From novice to tech pro — start learning today.