473,569 Members | 2,866 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

running command prompt from javascript

Uncle Dickie
67 New Member
Hi All,

I have a requirement (that to be perfectly honest I don't fully understand) to run "nbtstat - R" from a webpage. To quote from Microsoft: The nbtstat-R command purges the name cache and reloads all #PRE entries from the LMHOSTS file. #PRE entries are the LMHOSTS name entries that are preloaded into the cache.

To give a little more information this is for an embedded webserver product we make and from what I understand once we have programmed the MAC address the nbtstat-R needs to be run to register the changes. Possibly!!.

Anyway, I have a way of doing this in Internet Explorer:

Expand|Select|Wrap|Line Numbers
  1. function myTry(){
  2.     oShell = new ActiveXObject("wscript.shell");
  3.     oShell.run("cmd /K nbtstat -R");
  4. }
But I would really like the code to be cross browser compatible (if it is not possible I guess I will end up with a text section telling the user how to do it).

If anyone has any ideas of how I can achieve the above it would be much appreciated.
Apr 8 '09 #1
4 3503
gits
5,390 Recognized Expert Moderator Expert
it is not really possible to do that reliably in a cross-browser way ... for every browser and may be for every browser-version you would need to implement a specific solution, because it is definitly unsafe to let a webapp call such things at the client ... and a browser will not allow that ... and to let the browser do such things you would need to get privileges, that the user has to agree with, and you need to program against the specific browser-api to get such calls to work. i don't want to say that it is impossible but it has a lot of things that you cannot really control, because the user always has to agree with those actions.

kind regards
Apr 8 '09 #2
Uncle Dickie
67 New Member
That is pretty much what I feared so I'll just go for the disable button option with suitable text if ActiveX is not available.

Thanks for the input.
Apr 8 '09 #3
dmjpro
2,476 Top Contributor
This is not the question "ActiveXObj ect" only.
So many security concerns are dere ;)
Apr 8 '09 #4
gits
5,390 Recognized Expert Moderator Expert
ahh ... wait ... is the 'embedded' webserver on the client too? then you could of course do it 'serverside' ... which would be much more painless ;)

kind regards
Apr 8 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
6646
by: Eric Ching | last post by:
Can I run pythonw with a script that takes command line arguments then launches a GUI? I try pythonw myscript.pyw -option arg (etc.) and nothing happens. Nothing, as in I am immediately returned to the DOS prompt. I just started learning Python a couple of weeks ago, so please bear with me. I have a script that(for now) uses command line...
7
2092
by: MLH | last post by:
I have an sql script file that is supposed to create a set of database tables for me. Supposedly I type the following on my linux box and its all supposed to work... mysql (ENTER) \. mysql_dump.sql.txt When I type myslq <ENTER> I get a command prompt that looks like this...
4
11483
by: MLH | last post by:
I am having failures processing the following command and I wonder if you can tell me what I must do in order to have success. When I try to run source mysql_dump.sql.txt ==> it is a problem for me. 1) I put the file in /home/mlh/public_html/credifree/sql_script/. 2) I made that directory my current directory 3) I typed mysql and...
3
3492
by: Xarky | last post by:
Hi, I am writing a program, and need to execute a part of it in command prompt. When I execute it in command prompt, I type the following c:\> id3tag.exe music.wma show and it returns for me an XML file. How can I do that in C#. I was trying to do that by using the Process object but got lost.
3
6913
by: Lionel | last post by:
I've recently installed VS.Net 2003 on a desktop running Windows XP. When I try to create a new ASP.Net Web Application I get an error message. 'Visual Studio.Net has detected that the specified Web Server is not running ASP.NET version 1.1. You will be unable to run ASP.Net Web Applications or Services' ..NET Framework 1.1 is...
5
2227
by: vj | last post by:
Hi all, I am using C++Builder-5. I want to run multiple cpp files at the same time. If I use the C++Builder for running a cpp file (i.e., I just double click the cpp file, it then opens in the C++Builder, where I have the option to 'Run' it), I can't run multiple files, since the Run option is grayed out if one cpp file is already running....
10
5135
by: jon | last post by:
I am a beginner C programmer, this is actually my first programming lanugage, besides html, cgi, and javascript. I am looking for a way to make an .exe file, or a copy of my own file. I have tried writing a file, compling it, and reading it in a notepad, then writing a program to write it again, but i have had no luck. I assure you i'm not...
1
1621
by: TPhung | last post by:
Hi, I have a simple question about running python on windows xp command prompt. The file is as follows and is named spam.py: print 2**8 print 'the bright side' + 'of life' print "hello world" I run this on the command prompt as follows
51
4110
by: Ojas | last post by:
Hi!, I just out of curiosity want to know how top detect the client side application under which the script is getting run. I mean to ask the how to know whether the script is running under Command Prompt or Browser or some other application? Ojas.
6
14156
by: mjahabarsadiq | last post by:
Hi, I have written a java code to execute ant targets via Servlet. I have given the code below. import org.apache.tools.ant.*; import org.apache.catalina.ant.*; . . . .
0
7620
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7684
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7985
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5234
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1230
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
959
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.