Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

newb - replacing an old "sweep" program, exec an external program

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 03-09-2007   #1 (permalink)
Jeff Jarrell
Guest


 

newb - replacing an old "sweep" program, exec an external program

I am just getting started with PowerShell, again. I am building a
replacement for an old utility that would start at the current directory and
iterate down through the folders and simply execute the command given on the
command line.

Sweep.exe CMDTORUN PARMSFORCMDTORUN

This doesn't work because it seems like it wants to know where the program
is. And if it is an internal cmd.exe command I'd have to know that. I'd
like to just dump what ever the $cmd onto the prompt and let it go. Just
like perl backticks.
I know the attrib could be readily done in the script, but this isn't for me
to use.

So how do I go about executing an external program without knowing its
location or whether or not it is an internal cmd.exe command?

Thanks,
jeff

$cmd = "attrib -a"
$dirList = Get-ChildItem -path $baseDir -recurse | Where
{$_.psIsContainer -eq $true}

foreach ($dir in $dirlist)

{

&$cmd $dir.fullName

}



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Help Me Topic]Unexisting program still inside "Uninstall or change a Program" Arakai General Discussion 2 02-08-2008 12:59 PM
Can't get rid of "Info Icon" pop-up "This program cannot display.. MEL652 Vista General 0 02-05-2008 09:02 AM
Can't exec a program from another STAN1ZX Vista security 0 11-01-2007 11:43 AM
Microsoft exec: Future versions of Windows to be "fundamentally redesigned" Tiberius Vista General 3 05-30-2007 06:23 PM
"Recently Opened Programs" list and "Search for program" fail Jelle Kooi Vista installation & setup 0 02-13-2007 06:10 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51