Showing posts with label home. Show all posts
Showing posts with label home. Show all posts

Tuesday, May 31, 2011

Clear the print spooler

C:\>net stop spooler && del /q %WINDIR%\system32\spool\printers\* && net start spooler

Stops the print spooler service, clears out all queued print jobs, and restarts the spooler. This will fix a LOT of printer issues.

Copy matching files

C:\>cmd /v:on /c "for /f %i in ('dir /b *.JPG') do @(@set a=%i && @copy ..\!a:JPG=DNG! && @del /q !a!)"

I don't really use a photo management program. I know I should, but all the ones I've tried were either crap or expensive. When organizing photos from a particular event, I have a folder, say "Zoo," that contains the full-resolution raw files and the 2MP JPEG files from my camera. (I set my camera to RAW+JPEG, but the JPEG size to 2MP for easier management.) As I go through the images, I copy the good ones into a folder called "keepers." Afterward, I want to take the low-res JPEGs and replace them with the full-res raw files for processing.

At it's heart, this command is just:

C:\>for /f %a% in ('dir /b *.JPG') do @(@copy ..\%a:JPG=DNG% && @del /q %a%)

In other words, for all of the .JPG files in this directory, copy the corresponding .DNG file from the parent directory. If (and only if) that worked, delete the JPG.

But, as always, Windows needs a little handholding, first variable operations on a temporary loop variable, and then, to enable delayed expansion so that variables work in FOR loops.

In Linux, which is generally where I need this operation, it's a LOT more elegant:

for i in *;do cp ../${i%JPG}DNG . && rm $i;done

Saturday, May 28, 2011

Remove hidden attribute

C:\>attrib -h c:\* /s

I've seen a couple of malware infections lately that have set all files to hidden. Needed to run this to reset the attributes.

Friday, May 27, 2011

Open firewall ports

C:\>netsh firewall set portopening tcp 23 telnet

I don't think much explanation is required for this one...

System Uptime

C:\>systeminfo | find "System Up Time"

Will tell you how long since a computer's been rebooted. I use this when someone has a problem and SWEARS that they rebooted their PC four times this morning.

"Umm... well it says here you haven't rebooted since March. You know sleep and hibernate don't count, right?"

Notes:
Hibernate is an interesting beast, because it allows you to physically reboot the hardware without rebooting the software. I once hibernated a PC and replaced the hard drive. Several months later, I reinstalled the original drive to check something, and systeminfo reported the uptime as months.

Also, as always, FIND is case sensitive.