launch BAT file from script

Author Message
willem

  • Total Posts : 12
  • Scores: 0
  • Reward points : 0
  • Joined: 4/25/2005
  • Location: France
  • Status: offline
launch BAT file from script Monday, May 16, 2005 9:08 PM (permalink)
0
Hi there scripters,

I am trying to run a batch file from an ASP page.
from a .vbs script, the following code gives returncode 0:

oShell=wscript.createobject("wscript.shell")
rc=oShell.run("c:\test\test.bat",1,true)
wscript.echo rc

from my ASP page, I am doing the following:

oShell=createobject("wscript.shell")
rc=oShell.run("c:\test\test.bat",1,true)
response.write "rc=" & cstr(rc)

this does not execute the batch file, and returns rc=1.
The batch file (for the moment) just copies a file to another name.
(copy c:\test\test1.txt c:\test\test2.txt) just to check if it works.

What am I doing wrong ?
I tried:
rc=oShell.run("cmd /c c:\test\test.bat",1,true)
it doesn't work either.

thanks for your help in advance!
I posted the same topic in the ASP forum, but there are not a lot of people around...
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9