Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old November 4th, 2009, 12:44 PM
Corbin Dallas Corbin Dallas is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 5 Corbin Dallas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 53 sec
Reputation Power: 0
DOS Batch - User input (multiple words) to create folder name

It's been a LONG time since I have needed to write batch files, but here I am!

Ok, here's what I need, I have a script that currently requires the user to type the entire name of the current test as a folder name and many times they get it wrong.

Looking to automate this to eliminate some errors.


The users are creating folders like this:

PASS_OEM_TESTNAME_DATE_LOCATION

What I would like is for the batch to ask questions then concatenate the results.

Pass/Fail?

PASS_

OEM/ENG?

OEM_

TESTNAME?

ABCD_


etc...

Then create the folder

PASS_OEM_ABCD_ ...

I hope I explained this properly. THANKS!

Reply With Quote
  Trader Rating: 0 · #2  
Old November 4th, 2009, 04:38 PM
Corbin Dallas Corbin Dallas is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 5 Corbin Dallas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 53 sec
Reputation Power: 0
Getting closer...

Code:
@echo off
cls
:menu
ECHO ...........................
ECHO Test result, Pass or Fail?
ECHO ...........................
ECHO P - Pass
ECHO F - Fail
ECHO.
Set /p T= Test result? Pass or Fail?  
IF /i %T%==p goto pass
IF /i %T%==f goto fail
GOTO ERR

:err
ECHO Not a valid entry
Pause
ECHO Press any key to return to the menu
CLS
GOTO Menu

:pass
set result=PASS
:fail
set result=FAIL

cd %userprofile%\desktop
set folder=%result%_%date:~10,4%_%date:~4,2%_%date:~7,  2%
mkdir %folder%
pause


The problem is when I us "P" for pass, I still get FAIL as the output.

Any idea where I'm going wrong?

Thanks!
-Cd

Reply With Quote
  Trader Rating: 2 · #3  
Old November 4th, 2009, 04:49 PM
Dngrsone's Avatar
Dngrsone Dngrsone is offline
Designated Asshole
Click here for more information.
 
Join Date: May 2004
Location: In the space between you and I
Posts: 8,665 Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 175th Grade (Above 100000 Reputation Level)  Folding Points: 473755 Folding Title: Super Ultimate Folder - Level 1Folding Points: 473755 Folding Title: Super Ultimate Folder - Level 1Folding Points: 473755 Folding Title: Super Ultimate Folder - Level 1Folding Points: 473755 Folding Title: Super Ultimate Folder - Level 1Folding Points: 473755 Folding Title: Super Ultimate Folder - Level 1Folding Points: 473755 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 1 Day 23 h 25 m 53 sec
Reputation Power: 12656
Wrong case, perhaps?

Or maybe you have to do this:

Code:
IF /i %T%=="p" goto pass
__________________
Ask Questions the Smart Way


"In front of a monitor is a dangerous place from which to view the world." --Terri Wells

Enable BSOD: Control Panel/Systems, Advanced Tab, hit the Settings button under Startup and Recovery, and under the System Failure area, uncheck the Automatically Restart checkbox.

Reply With Quote
  Trader Rating: 0 · #4  
Old November 4th, 2009, 05:30 PM
Corbin Dallas Corbin Dallas is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 5 Corbin Dallas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 53 sec
Reputation Power: 0
Sorry, I didn't mean I actually type "P" as seen. I just type p or P, either one should trigger the event.

I'm thinking it's part of the set command that I'm making my mistake on.

maybe it should be

set /p results=PASS

or???

Reply With Quote
  Trader Rating: 0 · #5  
Old November 4th, 2009, 07:41 PM
Corbin Dallas Corbin Dallas is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Nov 2009
Posts: 5 Corbin Dallas User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 53 sec
Reputation Power: 0
Geez I'm an idiot....

I forgot to tell the script where to go AFTER it has placed the "Pass" or "Fail" output....


goto EOF

DOH!!!

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > DOS Batch - User input (multiple words) to create folder name


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
     
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek