dim oShell
set oShell=WScript.CreateObject("WScript.shell")
oShell.run ("C:WINNTsystem32cmd.exe /c C:WINNTsystem32
otepad.exe")
set oShell=nothing
works as expected in the context of a .vbs script and doesn't work (with the following changes made...) when inserted in a .asp web page under IIS ?
dim oShell
set oShell=Server.CreateObject("WScript.Shell")
'
intReturn = oShell.run ("C:WINNTsystem32cmd.exe /c C:WINNTsystem32
otepad.exe")
response.write(intReturn)
set oShell=nothing
the Shell object is well created (i can check some of its properties) but the oShell.run command doesn't seem to execute the given command line.
I've made an ASP page that calls a small executable and collects its text output into a variable ("strExeOut") below. Below is some code similar to the one I use for that purpose.
strExe = "C:whatevermyprogram.exe -h1 -d33"
Set objShell = CreateObject("WScript.Shell") Set objScriptExec = objShell.Exec(strExe) strExeOut = objScriptExec.StdOut.ReadAll
I developed this in my own computer and the whole thing works like a charm, but unfortunately I assumed my hosting provider would let me run the (little and harmless) exe, and they won't.
Therefore I have to run only the "exe" portion of the code in another web server and send back the output to my website on the net. I'd like to get some feedback on what would be the best way to call an exe on another server, and to have the output sent back.
im using server object Wscript.Shell in an asp page to run a bat file, under C:inetpubwwwroot, and after i run the ASP page, it give me an error message that
Error Type: Microsoft VBScript runtime (0x800A0046) Permission denied /wss1/bat.asp, line 22
im sure that Windows Scripting Host is running well in my pc. But it still giving me this problem.below is my coding of the asp pages. Code:
Currently, I move a application from win 2000 server to 2003 server, I use some vbs file in this application, however, it seems that those vbs file can not be run from 2003 server. Below is my code, can some one point out what did I do wrong here?
DIm objShell Set objShell = Server.CreateObject("WScript.Shell") objShell.Run(ExeName) Set objShell = Nothing
I am currently in the process of converting a website from an existing web host to our servers. This website used the WScript.Shell command to execute a series of Java commands that would send an encrypted email.
I ran these commands directly on the server and they execute properly, but when I try to run them from within the WScript.Shell command then I get a return code of 1, and the actions that should be completed are not.
The shell is executing a .bat file which is in the same directory the text files it needs to run the following sample command(s): Code:
I am trying to run a command line from an ASP page. I am using windows 2003 with IIS6. I am able to get this to run on my local machine (Windows XP IIS5). Here is my code:
For win2k adv server/iis5.0 trying to run an external program from my asp routine that has multiple parameters, see following.
set shell = server.createobject("wscript.shell") shell.Run """f:phsDatahtmldochtmldoc.exe"" --webpage -f phsnew.pdf phsnew.htm"
program either doesn't get invoked, or has an error, but since it has no error log i can't check that, so not sure why not getting a result i have run the program successfully from the command line in that directory, so know it can be run in the first place and the asp program creates and writes files in the same directory so i don't think its a permission problem. asp doesn't complain with any errors.
I am trying to use the Run method of WScript.Shell to run a program that creates image files on the server. When I run the program through the command line it creates a text file and a bmp file which is what it is supposed to do.
If I run it from an asp page it doesnt do anything, it also doesnt give me any error messages. I can run the same vbscript code in a standalone vbs file on the server and it works right. Code:
I've been testing the WScript.Shell object and the Run command now for a server query. The file I am running generates a file with the server querys which i later on parse in my page. But there is a problem. When running the Run command om my Windows XP machine it all seems fine. But when trying to run it on my webserver (not configured by myself) I get an error, or the command fails. It's nothing wrong with the acctuall command but ASP seems to not want to allow the Run command.
First I though it had to do with user privilegies but after giving the IUSR_X full access it didn't help. So, does anybody know a solution for this? Exactly what do I have to configure, for what user, to make this work on my webserver (win2k).
Trying to view asp page which has the following code in Set obj = WScript.CreateObject('WScript.Shell')
It falls over on this line saying 'Activex cannot create component (wscript.shell)'. Doing the same in a .vbs file results in the same error. The platform is NT4 Server Service Pack 6a.
I have a big problem with some part of my code, where I'm using the wscript.shell method to open a file...
I've tried this:
dim shell set shell= createobject("wscript.shell") shell.run "C:Clip_CreatorTVSA02.bat" set shell=nothing
and this
Function fnShellExecuteVB() dim objShell set objShell = CreateObject("Shell.Application") objShell.ShellExecute "C:WINNT otepad.exe", "", "", "open",1 set objShell = nothing End Function
I don't get any error but the application doesn't starts, I've also tried executing the notepad.exe and occurrs the same, nothing happens, I don't get error but the notepad doesnt lunch...
I'm getting tired about this code, I've tried a lot of kinds of scripts but I got the same result...
I have a process that creates a whole bunch of files in a specified directory. The names of the files are the employee IDs with an .txt extension, so they are like
EMP001.txt EMP002.txt EMP003.txt
The background is a bit more complicated so I won't bore you with it, but I hope that I can add a button on the asp page that would
1) go to that specified directory, which is database-driven by the department id, such as
D:DepartmentDEPT001
and I'll be able to figure the directory path from the existing code
2) then loop through each employee id and append the employee name, so the above will become
The employee names are also database driven and my asp page will be able to provide the information.
What I would like is to have a button that would open the cmd.exe and make the appropriate changes, and then do the rename, and then close the cmd window.
I need to use nslookup on an asp page. So I use the sort of code I can see in the discussion group:
SET objShell = Server.CreateObject("Wscript.Shell") DIM objExec SET objExec = objShell.Exec("%comspec% /c nslookup -type=MX "&host)
but I get "access denied" on the SET statement. (It doesn't matter what command I am using in the shell.)
On the physical IIS application directory Web sharing is enabled I enable anonymous access I have full control for the internet guest account. I have permission for scripts and executables on the virtual directory application protection low read write directory browse
I have enabled web sharing for windowsSystem32. (I probably shouldn't have!)
Clearly there is something I have forgotten. But what?
I have installed MSDE on my local computer - Windows 2000 Professional. I have created a function which runs me a link whose path is placed in the input field. This function looks like this: Code:
I can run these commands successfully from the command-prompt on the server but from an ASP page, I get nothing not even an error. The Text output for NET PRINT is a blank text file.
I feel something is different on the permissions side because this code/approach use to work fine.
I'm using this code var file = new ActiveXObject("WScript.Shell"); file.Run(FileName);
but in case the file name is of type html i get the file in the same window and i'm 'loosing' my site.i want to have the new opened document in a new window.
I want to run batchfiles via the Shell, but accessible in the Browser via IIS. Actually, I'd like the server to start a command line ntbackup if a users selects to do so on an ASP in his webbrowser. Does anyone know how to create a shell object in an ASP?
in javascript attempting to get a string from somewhere sometimes will give you a string reading "undefined" or "object" now i know that this sort of thing happens in vbscript too, if i'm writing a universal "convert anything to a string" function what do i need to check for so that anything like "undefined" or "null" (or NULL) get's converted into ""?
I am trying to use the following code to refer to a form and control on my form. I am supposed to be using VBSCRIPT for this code. I always get an "object required: 'document' " error:
<% Dim Myform Set Myform = document.forms.thisform Myform.textbox1.value = "fish" %>
None of this code will work. Always get an error. Using Visual Interdev, plain ole ASP, and vbscript, and Win XP Pro with IIS 5.1
I've discovered an insidious bug with the VBScript Regular Expression object.I set the pattern to consist of the set of invalid filename characters plus comma. I set global property to true then do a replace on a SID. The Replace does nothing. However, if I attach the C++ (dev studio 2003) debugger to the IIS host process (dllhost.exe), every time I call RegExp.Replace, the stack for one of the process's threads gets scrambled. It ends up with the value 0x00000001 at the top of the stack! If your debugger is set to stop on access violations, it always catches one (invalid read trying to delete). The problem is insidious because, without the debugger running, you would never know this is happening. ASP returns no error. Potentially this could wreak havoc on your web application and cause bizarre failures later on. Has anyone else run into this one? It seems to happen only with the Replace method.
I have a record object (for instance, named record). I record.MoveFirst, then I set up a simple little loop:
For Each ofield in record.Fields ... Next
Within my loop, I want to test to see if it is the last iteration. That is, with a simple If...Then, I want to be able to complete something the last time through.
Is this possible, either with some sort of record.EOF type property, or some sort of record.Count type property (and then using a simple counter during iteration to count down until the last one)?
I'd like to try to be at least a little elegant... I understand its possible to iterate through the whole record twice, the first time to count, but that would obviously be a poor choice if any other method is available.
I have almost completed tweaking vbscript to run on mysql rather than the Access database it was designed for. Trial and error, luck and a bit of detective work have got me this far, however I am getting the following error when tryinf to update existing records in the database.
Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'RS.Find' /faq/admin/edit2.asp, line 7
The .Find text is black whereas all other "methods"(?) like the .Open are pink. Is it that the .Find method works with access and not mysql and if so waht is the equivalent or am I barking up the wrong tree?
how to use WScript in ASP? I figured out that if I use a WSH object to send the keystroke {F5} it will refresh the pages adequately. (see my thread Refreshing Pages! for what I am taling about) Anyway, this code: Code:
Set wshshell=WScript.CreateObject("wscript.shell") wshshell.sendkeys {F5}
Should accomplish this. Or something similar should work. Anyways, I don't entirely know how to do this.
I'm trying to use vbscript to run a Macro in MSAccess via Wscript.Shell. So far, I have tried every variation on notation imaginable, and no luck. I can get MSACCESS.EXE to open, but it never runs the Macro, and never closes (which is the final command in the macro).
On the other hand, running the exact same command in DOS works great. Does everything it's supposed to perfectly. Code:
Im beginner in VBScript.Im getting an errorregarding "Wscript" means whenever I use WScript object, it shows Errors as " Object required: WScript" & "Variable undefind : Wscript" . Mostly I get "Object required: Wscript" erroe message whenver I declare WScript object.
I need to run shell scripts from mozilla browser on unix side to start off tools. Giving direct link to it does not work in mozilla. Can i execute the shell scripts from ASP ? What other way is possible to start these shell scripts form mozilla browser on unix.
We have need to run server based .vbs files and other OS commands through active server pages i.e
Set oShell = Server.CreateObject("WScript.Shell") oShell.Run("c:somecmd.bat",,True)
Under Windows 2000 the EVERYONE group had read/execute rights against cmd.exe. Under 2003 this has been removed and in order to get my .asp file to execute the cmd shell I must grant the IUSR acct read/execute access to cmd.exe on the web server.
Is there a better approach or "best practice" to properly secure my web server and still be able to shell out to cmd.exe from asp?