473,399 Members | 4,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Dos commands

132 100+
Hi guys,

It's me again :-)

In Javascript it's perfectly possible to run a file using the Shell.

But is it also possible to perform multiple tasks but not at the same time?

So like opening the command and then send a second command that puts the good old Hello World in it. Just to make the test.

Expand|Select|Wrap|Line Numbers
  1. var shell=new ActiveXObject("WScript.Shell");
  2.  
  3. function openconnection()
  4. {
  5. shell.Run("cmd /K", 1);
  6. }
  7.  
  8. function command()
  9. {
  10. shell.Echo("Hello World");
  11. }
  12.  
This was something I tried but I get the error that it can't get the file
Nov 20 '08 #1
3 1392
gits
5,390 Expert Mod 4TB
just a note: fortunatly that is not! possible in JavaScript, it is microsofts JScript and uses ActiveX and relies on a MS-OS at all because of the WSH-usage ... you may only use this with IE and Windows and thats one of the reasons why IE is simply bad! a webapp shouldn't have such privileges because unaware users could be easyly harmed with such possibilities ...

just my 2 cents ... ;)

kind regards
Nov 20 '08 #2
Cainnech
132 100+
Although I agree with you to a certain extent, I do feel that it could be useful.

Ofcourse there will always be a risk of people using malicious webapps to do harm to one's pc, but in this case I'm the only user.

Besides the whole security issue is useless. Or you offer the ability to work with Dos-commands or you don't. But trying to limit it by just authorizing a few commands to be executed isn't going to work.

If I can't put "format c:" in the function then I can put it in a .bat file and call for the .bat-file. Stays absolutely the same. So trying to limit is just plain stupid.
My two cents. Thus making 4 cents already ;-)

But in other words, it's not possible which was my question. Thanks for the reply!
Nov 21 '08 #3
gits
5,390 Expert Mod 4TB
i didn't say that something is not possible ... i just said that it is not JavaScript ... it is just MS's use of the WSH and so everything that you might do with that is possible ... and even when it is not with the WSH you just need to write an ActiveX control that could easyly run outside any sandbox of the browser. so just to give a browser the ability to execute something like that is a potential security risk and saying that this is not a problem since only one person uses it is no intelligent argument, because the ability of using that in a harmful way is just given and doesn't make sense for a webbrowser or an application that runs in it ... in case you do an app for your own you could format your drive at your own command-line or use correct admin-tools to do that remote ... but a webapp should never do that and should never has the possibility to do that ... it is a simple idea of trust ... that could be just destroyed by offering such abilities ... and even worse by apps that uses them ...

ActiveX, WSH, IE have and are serious problems in this regard ...
Nov 21 '08 #4

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

Similar topics

2
by: timdoyle05 | last post by:
Hi, I have a question relating to how Unix commands can be issued from Python programs. Im am currently writing a large test script in python and I need this script to call three other separate...
2
by: Raquel | last post by:
Why can we not give db2 System commands (commands starting with 'db2' like db2ilist, db2look, db2move etc.) through the Command Center? It is so convenient to retrieve and change commands in the...
13
by: =?Utf-8?B?VmVybm9uIFBlcHBlcnM=?= | last post by:
I am using VS2005. I created a Windows Appication project. Inside the Server Explorer, I created a new SQLExpress database, and then created a new table. I added the rows, making my first row an...
6
by: Peted | last post by:
Hi wondering what is the best way to do this Need a user to click a button, that sends 3 or 4 string based commands via a TCP/ip socket link I can connect to the ip device no problems, am...
15
by: tmp123 | last post by:
Hello, Thanks for your time. We have very big files with python commands (more or less, 500000 commands each file). It is possible to execute them command by command, like if the commands...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.