|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
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! thanks for the help |
|
#2
|
|||
|
|||
|
It's been a long old time, but I think what you are after is %1 (for 1st parm)
|
|
#3
|
|||
|
|||
|
Quote:
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 |
|
#4
|
|||
|
|||
|
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 |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Batch: argument input |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|