By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,654 Members | 1,580 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,654 IT Pros & Developers. It's quick & easy.

running command prompt from javascript

Uncle Dickie
P: 67
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("");
  3."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
Share this Question
Share on Google+
4 Replies

Expert Mod 5K+
P: 5,390
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
P: 67
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

P: 2,476
This is not the question "ActiveXObject" only.
So many security concerns are dere ;)
Apr 8 '09 #4

Expert Mod 5K+
P: 5,390
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

Post your reply

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