Solved

Passing variables (or switches?) using HREF ?

Posted on 2003-11-17
4
277 Views
Last Modified: 2010-04-09
Hi, I'd like to do the following:

Problem is, this works fine:

<a href="file://c:\pingit.bat">Ping It</a>

This however, doesn't:

<a href="file://c:\pingit.bat 192.168.0.147">Ping It</a>

So when you click on the link, it would call pingit.bat and pass it the IP address listed.

But as soon as you add a variable/switch to it, it fails to call the batch file at all.

Any ideas ?

0
Comment
Question by:JamesMonaghan
  • 2
4 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 9763823
something to try:

<a href="file://c:\pingit.bat?192.168.0.147">Ping It</a>
0
 

Author Comment

by:JamesMonaghan
ID: 9765770
Alas no...

Anyone else ?
0
 
LVL 3

Accepted Solution

by:
monvelasquez earned 250 total points
ID: 9768201
try it this way..

<html>
<head>
<script language="vbscript">

function pingIt(ByVal IPAddress)
Dim WSH
Set WSH = CreateObject("WScript.Shell")

WSH.Run "C:\Pingit.bat " & IPAddress

Set WSH = Nothing

end function
</script>
</head>
<body>

<a href="javascript:pingIt('192.168.0.147')">Ping It</a>
</body>

</html>
0
 

Author Comment

by:JamesMonaghan
ID: 9769992
Excellent, that worked perfectly, thanks very much!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now