473,511 Members | 12,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to run a DOS command from ASP

PW

How can I run a DOS command from my ASP ?

(prefer to use html/vbscript solution rather than 3rd party add-ons)

Jul 19 '05 #1
3 6590
<%CreateObject("WScript.Shell").Run "%comspec /c copy C:\*.txt D:\" %>

See here:
http://msdn.microsoft.com/library/en...l/wsmthrun.asp
Ray at work

"PW" <pw*@NObigSPAMpond.net.au> wrote in message
news:O5**************@tk2msftngp13.phx.gbl...

How can I run a DOS command from my ASP ?

(prefer to use html/vbscript solution rather than 3rd party add-ons)

Jul 19 '05 #2
PW

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:uM*************@TK2MSFTNGP12.phx.gbl...
<%CreateObject("WScript.Shell").Run "%comspec /c copy C:\*.txt D:\" %>
See here:
http://msdn.microsoft.com/library/en...l/wsmthrun.asp

I can't see anything happening.

Heres what I'm trying to do ...

This DOS command ... echo ^G > LPT1 ... will send a chr(7), or BEL character
to a receipt printer I have connected to the clients PC. There is an
electronic cash drawer connected to the receipt printer. When the receipt
printer receives a chr(7)/BEL character, it kicks the cash drawer open.

I have tried sending chr(7) to the printer, but all it does is actually
print the little ASCII character, rather than ringing the BELL and opening
the drawer.

However, if I do exactly the same thing in DOS, the drawer opens correctly.

Therefore I need to perform a wscipt.shell command or equivilent to perform
the DOS function. I have tried every variation of the wscript.shell
command, and it won't run either a DOS batch file or a VBS script file.

I have scanned the web and this question is asked all over the place, but no
one seems to have a solution.


Jul 19 '05 #3
The code I posted would run on the SERVER, not the client, as this is an ASP
group. The code would be the same for client-side scripting, though, and
would run if security settings are set to allow it in the browser.

Ray at work

"PW" <pw*@NObigSPAMpond.net.au> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...

"Ray at <%=sLocation%> [MVP]" <myfirstname at lane34 dot com> wrote in
message news:uM*************@TK2MSFTNGP12.phx.gbl...
<%CreateObject("WScript.Shell").Run "%comspec /c copy C:\*.txt D:\" %>
See here:
http://msdn.microsoft.com/library/en...l/wsmthrun.asp

I can't see anything happening.

Heres what I'm trying to do ...

This DOS command ... echo ^G > LPT1 ... will send a chr(7), or BEL

character to a receipt printer I have connected to the clients PC. There is an
electronic cash drawer connected to the receipt printer. When the receipt
printer receives a chr(7)/BEL character, it kicks the cash drawer open.

I have tried sending chr(7) to the printer, but all it does is actually
print the little ASCII character, rather than ringing the BELL and opening
the drawer.

However, if I do exactly the same thing in DOS, the drawer opens correctly.
Therefore I need to perform a wscipt.shell command or equivilent to perform the DOS function. I have tried every variation of the wscript.shell
command, and it won't run either a DOS batch file or a VBS script file.

I have scanned the web and this question is asked all over the place, but no one seems to have a solution.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2534
by: TEK | last post by:
Hello I'm wondering if anyone out there might give some input/suggestions/viewpoints around the Command pattern. In my case, the number one priority for using the pattern is undo support. Some...
8
1333
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
2
9261
by: Chris Bolus | last post by:
I'm a teacher using MS Access on an RMConnect 2.4 network. On some workstations both I and my students sometimes get an error message when attempting to insert a command button on a form which...
2
6656
by: micahstrasser | last post by:
I have been trying for days to send a command to the command prompt through the shell() function in vb.net. For some reason it is not working. Here is the code: Private Sub Button1_Click(ByVal...
34
6822
by: Roman Mashak | last post by:
Hello, All! I'm implementing simple CLI (flat model, no tree-style menu etc.). Command line looks like this: <command> <param1> <param2> ... <paramN> (where N=1..4) And idea is pretty simple: ...
13
4474
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
1688
by: czerwww | last post by:
Can someone please help me? I have class for database connection and I need set command.commandTimeout. How can I do that? Code: Imports System.Data.SqlClient Imports System.Data Public Class...
3
18680
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however,...
51
4083
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...
0
7251
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
7430
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...
0
7517
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...
0
5673
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5072
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...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
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 ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.