Solved

Passing variables (or switches?) using HREF ?

Posted on 2003-11-17
4
279 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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 to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

773 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