Print Page | Close Window

Wscript.shell Run Command Not Work Prope

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=10145
Printed Date: 29 March 2026 at 6:02am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Wscript.shell Run Command Not Work Prope
Posted By: meteor
Subject: Wscript.shell Run Command Not Work Prope
Date Posted: 26 April 2004 at 3:49am

Hello

this is a problem on running dos applications
i am use this code for disconnecting users from RAS i run file manualy in Dos window and work properly but this folowing code run without error but dosnot work .after running asp page nothing happend and no changes to ts.txt but Using dos window it changed and have command resault inside. why ??

<%
ServerName = Request.ServerVariables("SERVER_NAME")
Set Shell = Server.CreateObject("Wscript.Shell")

  strKilluser = Server.MapPath("Kill.exe")
  strKilluser = strKilluser & " 127.0.0.1 meteor >> d:\etacpp\debug\ts.txt"
  response.write(strkillUser & "<BR>")
  Shell.Run strKilluser
set Shell = Nothing
%>



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus



Replies:
Posted By: pmormr
Date Posted: 26 April 2004 at 5:27pm
did you double check the parameters for your program?

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: meteor
Date Posted: 01 May 2004 at 3:03am

i cant understand your post . but when i test it manually in command shel it work . the resault returned by Run is Zero as Follow:

The Res Var have 0 value at End .

<%
ServerName = Request.ServerVariables("SERVER_NAME")
Set Shell = Server.CreateObject("Wscript.Shell")

  strKilluser = Server.MapPath("Kill.exe")
  strKilluser = strKilluser & " 127.0.0.1 meteor"
  strKilluser = strKilluser &" >> d:\etacpp\debug\ts.txt"

'This Following tow lines is For test:
  res = shell.Run ("%comspec% dir /c/k >> d:\etacpp\debug\ts.txt")
  response.write(res & "<BR>")

  res = Shell.Run (strKilluser)
  response.write(res & "<BR>")

  response.write(strkillUser & "<BR>")
set Shell = Nothing
%>

Last resault is :

0
0
D:\Etacpp\debug\Kill.exe 127.0.0.1 meteor >> d:\etacpp\debug\ts.txt

and nothing was added to ts.txt file..... its very important to me



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus


Posted By: Coco Brown
Date Posted: 03 May 2004 at 1:06pm

You can't use wscript.shell with ASP.

Try creating a component that makes the call, register it, and have your ASP script call that when you need it.



Posted By: meteor
Date Posted: 05 May 2004 at 3:03pm

First:
Why I Cant use Wscript.shell ??

Second:
Can U tell Me More ? Or Is there Any Free Component For Excuting Progs In Windows???



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus


Posted By: dpyers
Date Posted: 05 May 2004 at 3:27pm
Originally posted by Coco Brown Coco Brown wrote:

You can't use wscript.shell with ASP.

Try creating a component that makes the call, register it, and have your ASP script call that when you need it.


Sure you can use it. You have to have permission to execute it which isn't often granted on shared hosting, but you can run it from asp on your own machine. I use it to run some .bat  files that ping some  things.
Server Objects also has ASPExec - a free component that does pretty much the same thing.

I'd look at a permissions problem. Asp usually runs as I_USR, not as admin. If he's doing a killuser, the script will have to run as admin which means screwing around in iis on his machine. Error logs on the machine may show something.



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: meteor
Date Posted: 08 May 2004 at 6:55am

Hi

All Files Have Permission To Iuser_serverName But Why I dosnt Get Any Error And Why My Test Lines Dos not Work (even If Kill.exe need Permission)
'This Following tow lines is For test:

  res = shell.Run ("%comspec% dir /c/k >> d:\etacpp\debug\ts.txt")
  response.write(res & "<BR>")

Sincerely



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus


Posted By: meteor
Date Posted: 14 May 2004 at 7:34am

Hello
WOW ::::..
my computer is P1(pentium one) with 64 MB ram .. i run windows 2K advanced server . for debugging this problem i pressed alt+ctrl+del and turned to task manager and then Processes then i request for this page  WOW i can see killuser.exe in the tasks for about half of second but no resault ws returned by .. Why?

 



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus


Posted By: dpyers
Date Posted: 14 May 2004 at 8:13am

It might be a problem with ths scope of sio. Try redirecting the output from the shell - something like

 res = shell.Run ("%comspec% dir /c/k) >> d:\etacpp\debug\ts.txt"



-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: meteor
Date Posted: 15 June 2004 at 5:43am

Hello .
this is old Topic but I have problem Exist.
i tried to Debug Problem As this ways
First :
Kill.exe When You Pass it hostName and User ID it Will Kill User From RAS
Like : Kill.exe 127.0.0.1 Cafe123
1- i run Command(CMD) from Run Menu and inside it Tried This
 d:\wwwroot\Kill.exe 127.0.0.1 Cafe20
 and resault(output) is Like This
  cafe10
  cafe13
  Cafe16
  New23
  cafe20 -x-
  ...
Then This User Was Disconnected From Ras
if User Dos not Exist Above list Will show but Without -x-
this is Good .
now I try this
d:\wwwroot\kill.exe 127.0.0.1 cafe20 >> d:\wwwroot\kill.txt
bomb... this File Created and Have above Resault inside
now i exit Command env....
in My Script i tried This :


Set Shell = Server.CreateObject("Wscript.Shell")
Shell.Run "CMD /c Dir c:\ >> d:\wwwroot\kill.txt"

Resault is OK and List Of Drive c:\ is in the File
then i tried this Folow Codes But no Resault Except an Empty kill.txt File
(The File Kill.txt was Created But Empty)

Set Shell = Server.CreateObject("Wscript.Shell")
  strKilluser = Server.MapPath("execute\Kill.exe")
  strKilluser = "CMD /c "&strKilluser & " 127.0.0.1 " & user &" >> d:\wwwroot\kill.txt"
  Shell.Run strKilluser

And This Changed Lines


strKillUser = "CMD /c d:\wwwroot\kill.exe 127.0.0.1 test >> d:\wwwroot\kill.txt"


strKillUser ="CMD /c ""d:\wwwroot\kill.exe 127.0.0.1 test >> d:\wwwroot\kill.txt"""

After Each Test I Deleted Kill.txt File To Ensure Command Run Status
The Resault : Kill.txt File Was Created But is Empty Yet
(in Command Prompt i tried this : c:\>CMD /c DIR >> tst.txt  (OK) )



-------------
Sincerely
--------------------
http://www.TacPlusPlus.com - PowerFull Scripts For NTTacPlus



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net