Solved

How Do You Create Variables In A Batch Program?

Posted on 2006-06-09
2
297 Views
Last Modified: 2012-05-05
Before I get into this question, I thought I'd take a second to let everyone know how powerful a batch program can be. If you really think hard about it, you can solve a lot of your problems by creating batch programs. I just recently created a backup utility that back-up's my entire slew of documents including favorites and pictures, what a reality check. Yes, instead of going to some website and shelling $30 for some hi-tech backup utility, I made my own, pretty handy, I have to say. Just wanted to get that out of my system... so on to the question.

How can I create my own variables in my batch files and use them? What can I type (command) to have someone input into that variable a string... or basically how can I get the user to input something into my variable, so I can then play with it? Big points for this one. I would like to know.

Nicolae Crisan
HandyTech, DBA
0
Comment
Question by:ncwhiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
GuruGary earned 215 total points
ID: 16875623
Yes, batch programming is much more powerful than most people think.  Especially in Windows 2000, Windows XP and higher.

You can use the SET command with the /P switch.  Try this:

@echo off
set /p Name=Please enter your name:
echo Thank you, %Name%
0
 
LVL 1

Author Comment

by:ncwhiz
ID: 16875768
Hi Gary,
Sent you an email "Batch Programming, Question" and I will award you the points, because I got the right answer. THANKS!

Nicolae
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
iSeries email authority 6 93
ejb wildfly example 2 75
backup program with robocopy 6 75
print bytes of an integer 6 27
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question