473,287 Members | 1,899 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,287 software developers and data experts.

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 6574
<%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
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
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
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
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
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
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
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
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
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
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.