Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

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

Reply
 
Old 03-09-2007   #1 (permalink)
Jeff Jarrell


 
 

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
Reply

Thread Tools


Similar Threads
Thread Forum
"'Program' has stopped working, Windows will now close the program" Frequent Error General Discussion
"right click" and "open" on an icon does not start the program! Vista General
[Help Me Topic]Unexisting program still inside "Uninstall or change a Program" General Discussion
Can't get rid of "Info Icon" pop-up "This program cannot display.. Vista General
"Recently Opened Programs" list and "Search for program" fail Vista installation & setup


Vista Forums 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 Ltd

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