4,776 reputation
1952103
bio website security.stackexchange.com
location Florida
age 32
visits member for 4 years, 4 months
seen Jan 23 at 22:12

I'm not the droid you're looking for.


Sep
24
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
Sorry about the confusion in DEL /S. I must have been reading about the same switch in a different section of the TCC docs or something. As for PowerShell, you've got to go back to Windows 2000/Me before you find an OS it can't run on. (And TCC can't go that far back either, though its predecessors may.) XP/2003 can't get the latest and greatest, and some of the newer modules aren't available below the latest Windows versions even with the same PowerShell version installed, but they can all still go up to at least PowerShell 2.0 which generally covers all the essentials.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
@RubenBaden If you ran the command exactly as-is in the answer, and only changed C:\*path*, you'll find the output in a file called "xxxxxxx.csv" within the current working directory.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
If you're simply talking about similarity in command name alone, PowerShell has built-in aliases to re-direct many common CMD commands to the new PowerShell alternatives. (Example: dir calls Get-ChildItem.) PowerShell can also make direct use of most other native CMD commands, and many external commands, without any special accommodations needed.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
I get that DIR /T:A /OD might be familiar to CMD users, but I don't see how the DIR syntax, or the DIR filtering syntax should be. DEL /S in CMD does something completely different, and neither DIR nor DEL have any native filtering functionality similar to what is used here that I'm aware of or able to find.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
@RubenBaden \\ is just a UNC path designator to tell the system you're specifying a resource on the network instead of locally. As far as when it's finished, you'll know when it produces output and/or returns you to the command prompt. If output has been redirected to a file, you won't see it on-screen. After the command prompt re-appears, just open the output file.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
1. Get-ChildItem | Sort-Object LastAccessTime, 2. Get-ChildItem | Where-Object {$_.LastAccessTime.Year -le 2008}, 3. Get-ChildItem | Where-Object {$_.LastAccessTime.Year -le 2008} | Remove-Item -WhatIf, 4. Get-ChildItem | Where-Object {$_.LastAccessTime.Year -le 2008} | Remove-Item. Given that PowerShell is 100% free, comes with Windows 7+, has commands and parameters that are generally much more human-readable and human-parseable than the syntax in this answer, and has a built-in help system plus gobs of online community support, I'm not sure how it's more "daunting" than TCC.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
@RubenBaden Change C:\*path* to the network path you want searched. Example: \\FileServer\ShareName.
Sep
23
comment Way to list and cat all files that contain string X in powershell
@musher That's happening because, by default, Select-String returns all lines that match what you're looking for. Using the -Quiet parameter avoids that, and instead returns a simple Boolean value. The script in my answer also avoids the issue by using Select-String as part of another matching condition instead of actually taking the output directly.
Sep
23
comment Powershell script to open a number of files located inside subdirectories
@val I also suggest you try using PowerShell's built-in help functionality whenever you're having trouble with a command. The cmdlet is Get-Help. (Example: Get-Help Invoke-Item) Depending on what version of PowerShell you're using, you may need to Update-Help first.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
@RubenBaden Copy/paste.
Sep
23
comment Deleting all files that do not match a certain pattern - Windows command line
Note: PowerShell comes with Win 7/8. For Windows XP or Vista, you need to download and install it.
Sep
23
comment Deleting all files that do not match a certain pattern - Windows command line
From the CMD prompt, this should work: PowerShell.exe -Command "&{Remove-Item C:\MyFolder\* -Exclude '*.jpg'}"
Sep
23
comment how to boot without power button
Got a warranty? Send that sucker in before it expires and you're stuck with a broken power button for life!
Sep
23
comment how to boot without power button
Great idea... until the laptop runs out of power and shuts down completely one day.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
Nice job on the calculated value for Kbytes, too. I didn't realize you could do that.
Sep
23
comment Managing a drive - searching for files that are rarely in use (so I can delete them for space)
I'd suggest just dropping this on the PowerShell console, instead of running it as a PS1. Saves the hassle of having to work around ExecutionPolicy and such. I like the addition of Export-CSV!
Sep
23
comment Full permissions on folder when remoted in, but read only through the network
If your computer is not on the same domain, are you really supposed to be copying files from that server to your computer or vice-versa? Sounds like you may be trying to circumvent some corporate policy here.
Sep
23
comment Way to list and cat all files that contain string X in powershell
What kinds of files are these?
Sep
23
comment Way to list and cat all files that contain string X in powershell
Are you wanting the whole file contents, or just the lines containing the string? Also, what kind of files are these?
Sep
21
comment Run a command in a batch file on the system clock
Not sure if batch is really good for this. How do you feel about PowerShell?