Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

batch file environment variables

Original Message
Name: esteban
Date: February 3, 2008 at 14:45:26 Pacific
Subject: batch file environment variables
OS: Windows Vista Home Premiu
CPU/Ram: Intel Core 2 Duo @ 2.67 G
Model/Manufacturer: Dell XPS 410
Comment:
I am trying to set environment variables with batch files by getting user input, something like this:

set /p input = "Type something here: "
echo You typed %input%.
if "%input%" == "stop" goto stop

I run the file without @echo off at the beginning, for debugging. The output looks something like this:

C:\>test.bat

C:\>set /p input = "Type something here: "
Type something here: stop

C:\>echo You typed .
You typed .

C:\>if "" == "stop" goto stop

So basically the variable isn't getting stored properly for some reason. But the galling thing is that if I go back to the command line and check the environment variables with set, the variable input IS defined, and it contains "stop". Any reason why this might be happening?


Report Offensive Message For Removal


Response Number 1
Name: klint
Date: February 3, 2008 at 15:34:53 Pacific
Subject: batch file environment variables
Reply: (edit)
Yes, the variable you are setting is called "input " (ending with a space) but you are trying to use "input" (without a space.)

Report Offensive Follow Up For Removal

Response Number 2
Name: esteban
Date: February 3, 2008 at 16:25:30 Pacific
Subject: batch file environment variables
Reply: (edit)
Wow, I can't believe I didn't notice that before. Thanks a ton!

Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: batch file environment variables

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




acer 312T BIOS problem

K7 Turbo possible max fsb?

Pc anywher problem

WinFLP & OE/Outlook2003

Computer resets after a few minutes


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC