using DIR with wshshell.run 
Author Message
 using DIR with wshshell.run

--dir.wsf---
<job>
<script language='JScript'>
var wshshell = new ActiveXObject("WScript.Shell");
wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true);
</script>
</job>
---end--

Run this from the root of the folders of interest.

--
Mark L. Ferguson  Please reply in newsgroup
marfers notes for OE5 >   http://www.*-*-*.com/

Quote:

> I need to know how to execute the dir command from WSH.  What I want to do
> is a DIR *.PAB /o /l /b /s > foo.txt

> what's the best way to do this?

> thanks!



Sat, 07 Sep 2002 03:00:00 GMT  
 using DIR with wshshell.run
I need to know how to execute the dir command from WSH.  What I want to do
is a DIR *.PAB /o /l /b /s > foo.txt

what's the best way to do this?

thanks!



Sun, 08 Sep 2002 03:00:00 GMT  
 using DIR with wshshell.run
how about in VBScript?



--dir.wsf---
<job>
<script language='JScript'>
var wshshell = new ActiveXObject("WScript.Shell");
wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true);
</script>
</job>
---end--

Run this from the root of the folders of interest.

--
Mark L. Ferguson  Please reply in newsgroup
marfers notes for OE5 >
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:
> I need to know how to execute the dir command from WSH.  What I want to do
> is a DIR *.PAB /o /l /b /s > foo.txt

> what's the best way to do this?

> thanks!



Sun, 08 Sep 2002 03:00:00 GMT  
 using DIR with wshshell.run
Not a lot of difference here, specify the different script tags and then
this

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run ("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true)

Shawn


Quote:
> how about in vbscript?



> --dir.wsf---
> <job>
> <script language='JScript'>
> var wshshell = new ActiveXObject("WScript.Shell");
> wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true);
> </script>
> </job>
> ---end--

> Run this from the root of the folders of interest.

> --
> Mark L. Ferguson  Please reply in newsgroup
> marfers notes for OE5 >
> http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


> > I need to know how to execute the dir command from WSH.  What I want to
do
> > is a DIR *.PAB /o /l /b /s > foo.txt

> > what's the best way to do this?

> > thanks!



Sun, 08 Sep 2002 03:00:00 GMT  
 using DIR with wshshell.run

Quote:

> how about in vbscript?

  set wshshell = CreateObject("WScript.Shell")
  wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true)

Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/

Quote:


> --dir.wsf---
> <job>
> <script language='JScript'>
> var wshshell = new ActiveXObject("WScript.Shell");
> wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true);
> </script>
> </job>
> ---end--

> Run this from the root of the folders of interest.

> --
> Mark L. Ferguson  Please reply in newsgroup
> marfers notes for OE5 >
> http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


> > I need to know how to execute the dir command from WSH.  What I want to do
> > is a DIR *.PAB /o /l /b /s > foo.txt

> > what's the best way to do this?

> > thanks!



Sun, 08 Sep 2002 03:00:00 GMT  
 using DIR with wshshell.run
---call.wsf---
<job>
<script language="JScript">
function go() {
var wshshell = new ActiveXObject("WScript.Shell");
wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true);
Quote:
}

</script>
<script language="VBScript">
go()
</script>
</job>
---<g>---

--
Mark L. Ferguson  Please reply in newsgroup
marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:

> how about in vbscript?



> --dir.wsf---
> <job>
> <script language='JScript'>
> var wshshell = new ActiveXObject("WScript.Shell");
> wshshell.run("%comspec% /c DIR *.PAB /o /l /b /s > foo.txt", 0, true);
> </script>
> </job>
> ---end--

> Run this from the root of the folders of interest.

> --
> Mark L. Ferguson  Please reply in newsgroup
> marfers notes for OE5 >
> http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


> > I need to know how to execute the dir command from WSH.  What I want to do
> > is a DIR *.PAB /o /l /b /s > foo.txt

> > what's the best way to do this?

> > thanks!



Sat, 14 Sep 2002 03:00:00 GMT  
 using DIR with wshshell.run

Here's an example using the attached batch.wsc (Windows Script Component)...

  set batch = createobject("batch.wsc")
  '
  'get a sorted array of txt file names
  '
  batch.execute "dir ""c:\*.txt"" /a-d /b /on"
  if batch.StdOutCount > 0 then
      msgbox join(batch.StdOutLines,vbcrlf)
      'msgbox batch.StdOutText 'this is equivalent
  else
    msgbox "no matching files found..."
  end if

See comments in batch.wsc for full syntax...

--
Michael Harris
MVP Scripting


I need to know how to execute the dir command from WSH.  What I want to do
is a DIR *.PAB /o /l /b /s > foo.txt

what's the best way to do this?

thanks!

  Batch.wsc
6K Download


Sun, 15 Sep 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. using DIR with wshshell.run

2. using DIR with wshshell.run

3. using DIR with wshshell.run

4. WshShell.Run vs WshShell.Exec

5. runas with WshShell.Exec versus WshShell.Run

6. Using variables in WshShell.Run ("....")

7. Using a variable within WshShell object and Run method (newbie at work)

8. Using WshShell.Run with a shortcut

9. Opening a Program using WshShell.Run in an asp page

10. Syntax for running a command using WshShell

11. Using WshShell.Run to launch console app

12. using WshShell.Run - error returned

 

 
Powered by phpBB® Forum Software