Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 24th, 2006, 11:28 PM
vietboy505 vietboy505 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 263 vietboy505 User rank is Corporal (100 - 500 Reputation Level)vietboy505 User rank is Corporal (100 - 500 Reputation Level)vietboy505 User rank is Corporal (100 - 500 Reputation Level)vietboy505 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 5 h 24 m 51 sec
Reputation Power: 10
Question Batch: argument input

If I have a batch script call abc.bat inside C:\WINDOWS\
from command prompt and I type > abc
I will get the argument is ...

I want to get the argument from DOS and print it out.. like this..
I was wondering if I type > abc hello
the argument is ... hello
>abc "hello there!"
the argument is ... hello there!

DOS Code:
Original - DOS Code
    echo "the argument is ..."


thanks for the help

Reply With Quote
  #2  
Old May 25th, 2006, 05:44 AM
SimonJM SimonJM is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Mar 2006
Posts: 2,108 SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level)SimonJM User rank is General 8th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 4 h 41 m
Reputation Power: 1485
It's been a long old time, but I think what you are after is %1 (for 1st parm)

Reply With Quote
  #3  
Old May 29th, 2006, 08:32 PM
vietboy505 vietboy505 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 263 vietboy505 User rank is Corporal (100 - 500 Reputation Level)vietboy505 User rank is Corporal (100 - 500 Reputation Level)vietboy505 User rank is Corporal (100 - 500 Reputation Level)vietboy505 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 5 h 24 m 51 sec
Reputation Power: 10
Wink

Quote:
Originally Posted by SimonJM
It's been a long old time, but I think what you are after is %1 (for 1st parm)


thx

what about I don't how many inputs they input? The code below only print out the number, but I also want the input too..
if i type > hello a b c d e

I want to get a b c d e back too

hello.bat
BATCH Code:
Original - BATCH Code
    FOR /L %%A IN (1,1,10) DO ( echo "-> %%A <-" )

Reply With Quote
  #4  
Old June 1st, 2006, 05:36 PM
sfb sfb is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2003
Posts: 623 sfb User rank is Sergeant Major (2000 - 5000 Reputation Level)sfb User rank is Sergeant Major (2000 - 5000 Reputation Level)sfb User rank is Sergeant Major (2000 - 5000 Reputation Level)sfb User rank is Sergeant Major (2000 - 5000 Reputation Level)sfb User rank is Sergeant Major (2000 - 5000 Reputation Level)sfb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 5 h 53 m 21 sec
Reputation Power: 33
If you don't know how many there are, then you need to 'shift' them - it moves them all left one, and drops the first one:

Code:
@echo off
rem Call me with loads of arguments

:top
echo %1
shift
if not "%1"=="" goto top


(shift /? for limited help)

Code:
D:\>test.bat a b
a
b

D:\>test.bat a b c d
a
b
c
d

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Batch: argument input

Developer Shed Advertisers and Affiliates



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

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


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap