
Some Shell commands don't work
Hi
You must use "cmd.exe /c" (wnt\w2k) or "command.com /c" (w9x) in friont of DOS
commands. The best thing is to use %comspec% to obtain OS version independency.
You also should use ", 1, True" or ", 0, True" behind the run statement, or
else your script will not wait for yor command to be finished before continuing!
Description on 0\1 on the line above: 1 will give you a flashing DOS box as the
DOS command is run, 0 will make it invisible.
This should work for you:
Dim objShell
Set objShell=CreateObject("Wscript.Shell")
objShell.Run "%comspec% /c sort <c:\schijven.txt> c:\vijg.txt", 0, True
Set objShell = Nothing
Regards,
Torgeir
Quote:
> This is the code that I used:
> Dim objShell
> Set objShell=CreateObject("Wscript.Shell")
> objShell.Run "sort <c:\schijven.txt> c:\vijg.txt"
> Set objShell = Nothing
> Thank you for your support.
> Teun.
> > Hi
> > Sort.exe works from .Run
> > Could you post your code (and the path\file names you use)? It is much
> easier to
> > help then.
> > Regards,
> > Torgeir
> > > There are several commands which not work if you put them in a vbScript.
> > > Such as sort don't work and why is that am I doing something wrong.