DTS / Execute Process issue

  • I've written a DTS that starts by executing a .bat file. Once every few times it recieves an error indicating that the path is incorrect and it aborts. If I simply re-execute the program it usually runs ok. The objects the bat file is referring to are in the Winnt folder which is in the path. What am I missing?

    Thanks

  • Not sure what is wrong. That's kind of strange. Could the .bat already be executing and a lock on that file?

    Steve Jones

    steve@dkranch.net

  • What is the bat file doing and how does it relate to the DTS package? Have you got flow logic in place to make sure step in package are excuted in a specific sequence? If not could something that occsionally happens first be out of order without the logic since DTS can execute multiple items at a time?

    "Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)

  • What it does is executes a dos batch file. This batch file opens a text file in the directory the batch file resides in and reads it. The message that appears is that the directory it is executing in is something other than c:\winnt. c:\winnt is the directory a vbscript that is called by the batch file lives. Since c:\winnt is in the login path statement and when I execute cmd.exe and type path it appear there I am confused as to why the error occurs. I have noticed that when I am working with explorer (not internet exporer) moving files around in other areas besides the one the DTS is involved with, this error seems to occur. The message returned by cmd.exe is:

    CMD.EXE was started with '\\somefolder\somefolder' as the current directory path. UNC paths are not supported. Defaulting to Windows directory. Then:

    Input Error: Cannot find script file "c:\winnt\convert.vbs

    Here is a copy of the batch file:

    @ECHO OFF

    cscript c:\winnt\convert.vbs "E:\some folder\some folder\folder\folder\folder"

    and the VBscript it executes:

    Option Explicit

    dim objFileSystem

    dim objReadFile

    dim strReadLine

    dim objWriteFile

    dim objFolder

    dim objFile

    Set objFileSystem=CreateObject("Scripting.FileSystemObject")

    Set objFolder=objFileSystem.GetFolder(Wscript.Arguments(0))

    For Each objFile in objFolder.Files

    objFileSystem.CopyFile objFile,objFile.ParentFolder&"\temp.txt"

    Wscript.Sleep 2000

    Set objReadFile=objFileSystem.OpenTextFile(objFile.ParentFolder&"\temp.txt",1)

    Set objWriteFile=objFileSystem.OpenTextFile(objFile.Path,2)

    Do While objReadFile.AtEndOfStream<>True

    strReadLine=objReadFile.ReadLine

    objWriteFile.WriteLine strReadLine

    Loop

    Wscript.Sleep 2000

    objReadFile.Close

    Set objReadFile=Nothing

    objWriteFile.Close

    Set objWritefile=Nothing

    objFileSystem.DeleteFile objFile.ParentFolder&"\temp.txt"

    Next

  • What it does is executes a dos batch file. This batch file opens a text file in the directory the batch file resides in and reads it. The message that appears is that the directory it is executing in is something other than c:\winnt. c:\winnt is the directory a vbscript that is called by the batch file lives. Since c:\winnt is in the login path statement and when I execute cmd.exe and type path it appear there I am confused as to why the error occurs. I have noticed that when I am working with explorer (not internet exporer) moving files around in other areas besides the one the DTS is involved with, this error seems to occur. The message returned by cmd.exe is:

    CMD.EXE was started with '\\somefolder\somefolder' as the current directory path. UNC paths are not supported. Defaulting to Windows directory. Then:

    Input Error: Cannot find script file "c:\winnt\convert.vbs

    Here is a copy of the batch file:

    @ECHO OFF

    cscript c:\winnt\convert.vbs "E:\some folder\some folder\folder\folder\folder"

    and the VBscript it executes:

    Option Explicit

    dim objFileSystem

    dim objReadFile

    dim strReadLine

    dim objWriteFile

    dim objFolder

    dim objFile

    Set objFileSystem=CreateObject("Scripting.FileSystemObject")

    Set objFolder=objFileSystem.GetFolder(Wscript.Arguments(0))

    For Each objFile in objFolder.Files

    objFileSystem.CopyFile objFile,objFile.ParentFolder&"\temp.txt"

    Wscript.Sleep 2000

    Set objReadFile=objFileSystem.OpenTextFile(objFile.ParentFolder&"\temp.txt",1)

    Set objWriteFile=objFileSystem.OpenTextFile(objFile.Path,2)

    Do While objReadFile.AtEndOfStream<>True

    strReadLine=objReadFile.ReadLine

    objWriteFile.WriteLine strReadLine

    Loop

    Wscript.Sleep 2000

    objReadFile.Close

    Set objReadFile=Nothing

    objWriteFile.Close

    Set objWritefile=Nothing

    objFileSystem.DeleteFile objFile.ParentFolder&"\temp.txt"

    Next

  • I am having a similar problem. I have the following .bat file:

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

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

    :SETDIRECTORY

    cd I:\MJCDevelopments\WorkBox_SQLServer

    :COPYTOBUCKET

    copy fileA.xls ..\CompletedJobs_SQLServer /Y

    copy fileB.xls ..\CompletedJobs_SQLServer /Y

    :NOWDELETEFROMDROPBOX

    del fileA.xls

    del fileB.xls

    :END

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

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

    Basically, it moves fileA and fileB from one

    folder to another. It works when I run it directly

    from Windows explorer or the MS-DOS command

    prompt. However, when I have it in a DTS package

    it says that it has completed successfully but in

    fact it has not achieved what it is supposed to do.

    The .bat does not depend on anything in the DTS

    flow. Indeed, when I right-click and

    select "Execute step" for the .bat file alone in

    the DTS designer, it does not work even then!

    There is something about running the .bat file in

    DTS that is causing it to not work.

    Any ideas would be appreciated!

    Cheers...

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply