Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Batch File Argument

Posted on 2009-04-01
3
Medium Priority
?
3,516 Views
Last Modified: 2012-06-27
I want a dos batch file  that doing this;

from dos prompt:
c:\> run-xx-yy.cmd 1

the dos-batch-file will looks like this


@ECHO OFF
Select case
  case 1
      run iexplore.exe "http://webpage1"
  case 2
      run iexplore.exe "http://webpage2"
  case 3
      run iexplore.exe "http://webpage3"
  case else
     ' nothing
end select


Hopes my psesudo VB code are understandable.

thank's in advanced!
0
Comment
Question by:dingir
[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
3 Comments
 
LVL 43

Accepted Solution

by:
Steve Knight earned 1400 total points
ID: 24036743
Well in a batch file "%1" gets the first argument so your batch file could be something like:

@echo off
if "%1"=="" echo You need to supply an argument & goto :eof
if %1==1 iexplore "http://webpage1" & goto :eof
if %1==2 iexplore "http://webpage2" & goto :eof
echo No number matched & goto :eof

etc.

or using a temporary variable:

@echo off
if "%1"=="" echo You need to supply an argument & goto :eof

 set webpage=
 if %1==1 set webpage=webpage1.url.com
 if %1==2 set webpage=webpage1.url.com

if not "%webpage%"=="" echo No number matched & goto :eof
iexplore "http://%webpage%"

Steve
0
 
LVL 1

Author Comment

by:dingir
ID: 24036779
Outstanding!
And to share with the world (if anyone more needs it)


Batch file
-----
if "%1"=="" echo You need to supply an argument & goto :eof

REM 1 - create xinvoice
if %1==1 D:\xy.vbs "http://xy:718/?cmd=xxyy" & goto :eof

REM 2 - recieve payments
if %1==2 D:\dbs\xy.vbs "http://xy:718/?cmd=xxyy2" & goto :eof

REM 3 - recieve status
if %1==3 D:\dbs\xy.vbs "http://xy:718/?cmd=xxyy3" & goto :eof

echo No number matched & goto :eof
:eof
---------

And the vbs file xy...
---------
Dim objRequest, URL
Set objRequest = CreateObject("Microsoft.XMLHTTP")
URL = Wscript.Arguments.Item(0)
objRequest.open "POST", URL , false
objRequest.Send
Set objRequest = Nothing
---------
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 24036802
No problem, glad it worked for you.

Steve
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

618 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