Microsoft added a new command line tool to Vista and Windows 7: clip.exe. This nifty little utility allows user to copy program output to the clipboard on the windows command line. Its usage is pretty straightforward:
dir | clip – copies the output of the dir command to the clipboard
clip < example.txt – copy the contents of the file example.txt to the clipboard
I came across a really annoying problem while using win32 sockets one of my bigger projects. In short, the VisualC compiler complained about redefinitions of basic Windows socket macros:
C:\sdk\windows\v6.0a\include\ws2def.h(91) : warning C4005: 'AF_IPX' : macro redefinition
C:\sdk\windows\v6.0a\include\winsock.h(460) : see previous definition of 'AF_IPX'
C:\sdk\windows\v6.0a\include\ws2def.h(124) : warning C4005: 'AF_MAX' : macro redefinition
C:\sdk\windows\v6.0a\include\winsock.h(479) : see previous definition of 'AF_MAX'
C:\sdk\windows\v6.0a\include\ws2def.h(163) : warning C4005: 'SO_DONTLINGER' : macro redefinition
C:\sdk\windows\v6.0a\include\winsock.h(402) : see previous definition of 'SO_DONTLINGER'
C:\sdk\windows\v6.0a\include\ws2def.h(206) : error C2011: 'sockaddr' : 'struct' type redefinition
C:\sdk\windows\v6.0a\include\winsock.h(485) : see declaration of 'sockaddr'
C:\sdk\windows\v6.0a\include\ws2def.h(384) : error C2143: syntax error : missing '}' before 'constant'
C:\sdk\windows\v6.0a\include\ws2def.h(384) : error C2143: syntax error : missing ';' before 'constant'
C:\sdk\windows\v6.0a\include\ws2def.h(384) : error C2059: syntax error : 'constant'
C:\sdk\windows\v6.0a\include\ws2def.h(437) : error C2143: syntax error : missing ';' before '}
(...)
Read more…
It’s pretty convenient to list and kill processes using ps and kill / pkill on *nix. Actually, you can do that on a Windows command line as well:
- tasklist: shows a list of all running processes
- taskkill: kills processes
Among other options, processes can be killed by their process ID (taskkill /PID 4711) and by the name of their executable (taskkill /IM firefox.exe).
So, if you have perl scripts running wild, just execute taskkill perl.exe to kill all of them down with a single command.
More lesser known Windows commands are described in this PDF.
Some tools just keep amazing me. They are flexible, stable, small – basically, they just work. One of these tools is 7-Zip.
It does a lot more than just creating 7zip archives: it is able to create and open almost any package type I’ve run across so far. And it even reads .iso image files.
Thanks a lot for this marvelous tool – it’s a joy to use and a definitive must-have!
The Security Intel Analysis Team gives a pretty good summary of how the IE8 on Windows 7 got busted at the Pwn2Own during CanSecWest 2010. They show us a pretty interesting dive into the ideas behind data execution prevention in definitive must-read article.
Update:
zdnet provides (less verbose) background information on how the iPhone got hacked at the same event.