Solved

How Do You Create Variables In A Batch Program?

Posted on 2006-06-09
2
303 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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Progress

724 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