Re: help needed
- From: Alexander Mueller <millerax@xxxxxxxxxxx>
- Date: Mon, 17 Jul 2006 12:21:36 +0200
Walter Zackery schrieb:
Your very last statement "echo %ERRORLEVEL%" runs successfully, so it returns an exit code of 0 to the script! If you remove this statement it will solve your problem.
AFAIK 'Echo', as most internal dos commands, doesn't change the existing
errorlevel. The prob is the most likely that the COMSPEC (cmd.exe) needs to be switched in between to get to exitcode returned.
i = wShell.Run ("%comspec% /c C:\test1.bat", 1, True)
MfG,
Alex
<gemini.rajesh@xxxxxxxxx> wrote in message news:1153117083.223438.215840@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
: Im writing an bat file to rename an file with a new name, and i need to
: get the ERRORLEVEL value from this bat file into an VBScript.
: I m always getting an zero errorlevel when i run the bat file from the
: script
: My code is below...
:
: BAT FILE
: ---------------------------------
: @echo off
::: do something that sets errorlevel 1
: REN fil fils
: echo %ERRORLEVEL%
: (this would return an 1 when run from dos prompt)
:
: VBScript
: -------------------------------------
: Dim fso, wShell, i
: Set wShell = CreateObject("WScript.Shell")
: Set fso = CreateObject("Scripting.FileSystemObject")
: i = wShell.Run ("C:\test1.bat", 1, True)
: WScript.Echo i
: (This should return 1, but returns only 0)
:
: Y is this happening, is there anything wrong with my logic
:
: Rajesh.N
:
- Follow-Ups:
- Re: help needed
- From: Walter Zackery
- Re: help needed
- References:
- help needed
- From: gemini . rajesh
- Re: help needed
- From: Walter Zackery
- help needed
- Prev by Date: Re: Get Hostname from FQDN from DNS
- Next by Date: get data from an SQL database
- Previous by thread: Re: help needed
- Next by thread: Re: help needed
- Index(es):
Relevant Pages
|