Avatar of ezsas
ezsas
Flag for Canada asked on

Windows Shell script in ASP.

Hi,

On our web server, we have an application which was running windows shell commands from ASP page. The syntax we have was
******************************************
Dim WshShell
Set WshShell = Server.CreateObject("WScript.Shell")

ret= WshShell.Run( "c:\windows\system32\find.exe", 1, true)
**************************************************

As the hardware failed on the server, we had to change the physical server. Since then our windows shell commands are not working. We keep getting value for 'ret'=2 with in fraction of second. It looks to me some setting or service needs to be started on the server. If anyone have any clue, why it is not functioning,  please let me know ASAP.

Thanks
Ez
Microsoft DevelopmentScripting LanguagesMicrosoft IIS Web Server

Avatar of undefined
Last Comment
slightwv (䄆 Netminder)

8/22/2022 - Mon
Praveen Kumar Chandrashekatr

give us more details like what is the new OS in the new server and also give us the extact error which you are getting.

Also let us know that can you able to use command prompt or ipconfig ...
ezsas

ASKER
Only the hardware changed. OS remained same (win Server 2003). The command is something like this ( we have our commands instead of "fine.exe" in the sample line below).

ret= WshShell.Run( "c:\windows\system32\find.exe", 1, true)

There is no error message the return value of 'ret' variable is always 2. Which means error has occured, but it doesn't say what the error is.

The Command is running in fraction of second, which should not be the case
slightwv (䄆 Netminder)

c:\windows\system32\find.exe  by itself with no parameters returns a 2 and a usage statement:  FIND: Parameter format not correct

From a command prompt:
c:\windows\system32\find.exe
echo %ERRORLEVEL%

You should see "2"

If you actually find something:
c:\windows\system32\find.exe "Some text string" *.txt
echo %ERRORLEVEL%

You should see a 1.


There is an arguments property where you can add parameters for the find:
http://msdn.microsoft.com/en-us/library/yf7kaky2%28v=vs.84%29.aspx

If the script didn't change, these must have been set somewhere else on the old server.

What is it you are trying to 'find'?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ezsas

ASKER
I am sorry. my question was not clear. I know 'find.exe' needs parameters. I have my own command , which will not make any sense to you, so I replaced with some generic command to explain the point. I have some long command which works very well when I issue it from the command prompt but not thru the ASP winshell script. I am printing the winshell command by using 'response.write' and I am just copying the command on the prompt and it works perfectly this way. When the same command is issued thru ASP I think the command is not at all getting executed and is returning the value '2'.

My feeling is there is something (or service) that  I have to set on the server which I am not recollecting.

Hope I made it more  clear now.

Thanks
ASKER CERTIFIED SOLUTION
slightwv (䄆 Netminder)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question