For example, make a folder called "dir". Then make a vbs script like:
set oSh = createObject("Wscript.shell")
ret = oSh.run("dir >dir.out",0,true)
and execute the vbs in the folder containing the "dir" folder. Perhaps someone can shed some light on what caused this to start happening. Unless I'm weird in assuming that this method shouldn't try to execute folders.
Warm regards,
-tom
The solution is very easy and is in fact necessary to support redirections, anyway. Simply invoke the command processor explicitly, something like this ...
set oSh = createObject("Wscript.shell")
ret = oSh.run("%comspec% /c dir >dir.out",0,true)
I suspect the problem started with the creation of the folder named Xcopy, not with the installation of a security patch.
BTW, the example you used will not work as posted, since DIR is one of many command line statements hosted by the command processor.
Tom Lavedas
===========
Hi
For executables, my rule is to always add the .exe extension in the
Run statement to avoid this type of problems, so use "xcopy.exe"
instead of "xcopy" (note that dir is not an executable as it lives
"inside" cmd.exe)
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/community/scriptcenter/default.mspx
C:\lsbackup>dir
Volume in drive C is W2KPRO
Volume Serial Number is 209A-5AC7
Directory of C:\lsbackup
19/07/2004 17:40 <DIR> .
19/07/2004 17:40 <DIR> ..
<snip>
19/07/2004 16:44 <DIR> dir
19/07/2004 16:45 213 dir.vbs
// dir.vbs
' dir.vbs
set oSh = CreateObject("Wscript.shell")
ret = oSh.Run("dir > dir.out",0,true)
msgbox ret
set oSh = nothing
// running dir.vbs
C:\lsbackup>dir.vbs
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
C:\lsbackup\dir.vbs(6, 1) WshShell.Run: Unable to wait for process.
So it seems to happen regardless. I am moderately sure that this has only recently started happening.
I changed the xcopy commands to explicitly call the binary rather than rely on the execution path, which is probably neater anyway.
Warm regards,
-tom
ret = oSh.Run("dir > dir.out",0,true)
to this ...
ret = oSh.Run("%comspec% /c dir > dir.out",0,true)
for the problem to be solved.
Further, as both Torgeir and I pointed out, redirection will NOT work, unless the command processor is invoked IN THE RUN STATEMENT.
I am still convinced, your problem is in the way you are using the Run method (and/or the way you are naming folders) and has nothing to do with a security patch.