Power to Build

Home » Operating Systems » Windows 7

Category Archives: Windows 7


Tools: WindirStat – Diskspace Statistics Viewer/cleaner

I ran into a problem at work this morning – my hard disk was almost full, yet again. Couldn’t do any work as the machine was crawling. I have been backing up and cleaning up, but with so many different things I do (parsing huge log files is one culprit), I just cannot keep up. Over the last 3 years, I have been working on project after project, I have too many “important” files sitting on my disk – logs, tests, versions of programs and of course screenshots and documents.

Today, I really wanted to find those and archive them and cleanup my disk. But, where do I start and where exactly are those big files hiding? If you have used Windows Explorer and Search that comes with it, you will see what I mean. So, I went on a mission to find a better tool! While researching this, I stumbled upon a nice blog about cleaning up on Windows 7.

From there, I got onto the tool WindirStat! Great tool. I see a lot of programs every day, this one stands out. Program is very nicely written and is visually appealing. It scans the drive(s) and lists out the folders and files, sorta like what Windows Explorer does. But, it also visualizes, which is where it’s strength is (looks like scandisk, but this shows files).

That visualization really helps to get to extreme corners of your hard disk easily and find those unnecessary files that may be hiding there. I was able to find some GB’s of Windows memory dump files that even Windows disk cleaner didn’t find. This should have been part of Windows!

2016-02-02 17_16_10-C_ - WinDirStat

There, I just included a screenshot of the tool in action, so you can see what I am talking about. For starters you get a full list of folders with sizes in the top grid, nicely sorted with the biggest offender on top. Those colored cells/blocks in the bottom grid are your files and folders, perfectly color-coded by file type shown on the top right. You can click these file types to “identify” them in the bottom maze. You can click your way through that maze to find those files that you want to get to. Wow!

As a programmer, I am even more intrigued by this utility, as it puts TreeMaps to a great (ca)use! If you are interested, see here for a full overload on TreeMaps!

If you are in a similar situation and in need of a tool to cleanup your hard disk, this is definitely one of the must have. And if you are looking for similar tools on Linux, If you are looking for tools on Linux, apparently KDirStat has been superceded by K4DirStat and QDirStat. And on Unix you have du. Happy (file) hunting! But, before you toss those files, please make sure to back up.


Check if a process is running (Windows)

While making the script to switch the desktop between 2 versions of PB (see here), I needed a command expression to check if a task (PB and EAServer in this case) is running already. There are many ways to do it on *nix. But on Windows, it’s a bit convoluted. After researching on the net, this is what I came up with.

tasklist /nh /fi "imagename eq notepad.exe" | findstr /i "notepad.exe" >nul && (echo Notepad is running) || (Echo Notepad is not running)

That’s all in one line. If you need to break, use the continuation char, ^.

I use the above command expression in the batch file to check if a process is running already before running it again. I use this is a batch file I created to switch between 2 different versions of PowerBuilder (PB). I wanted to make sure, one version of PB is not running, before letting the user to switch, hence this check. (replace notepad.exe with PB125.exe above).


/nh means no header, /fi means filter. We are filtering for Notepad.exe only above. Then, we take that and look for Notepad.exe using a FindStr command. It will still work, even if we don’t have those 2 flags, but it makes finding the right program quicker.

&& and || are part of the conditional expressions see here. We use these to print for the IF…ELSE condition.

>nul is the equivalent of Unix /dev/null

Rest is self explanatory, I think.

I’ve also posted this scriptlet on the commandfu.com site.


Symbolic Links Contd…

Ever since I found symbolic links are available on Windows, I’ve used it in various places. To reduce the PATH entries, so it doesn’t overflow, to overcome program idiosyncrasies etc. In this post I will tell you what I did with some DLLs, so I could run different versions of a software.

Both the software are in the context of PowerBuilder, a development IDE from Sybase (Now SAP). PowerBuilder with a scripting language called ORCA. Each version of PowerBuilder comes with a version of a tool that implements OrcaScript. Most things you do inside PB IDE can be done through Orca script – for e.g., you can build, deploy entire workspaces or targets using Orca script. Yes, it’s typically used in automating build processes. Though PB comes with Orca Tool (called orcascr125.exe in PB 12.5), I had already used another tool PBOrca. I really like this tool, so I wanted to continue to use this tool. But, this is an older tool that may not work with/understand PB 12.5.

In a PBOrca script, to work with a particular version of PB, you use the Session Statement:

session begin pbOrc100.dll

The other use was when I did some beta testing with PowerBuilder 15 recently. To build and deploy our PB application, we use Powergen. This is a build tool developed by E.Crane computing for building complex PB applications. It resolves circular references in PB libraries and builds applications smoothly. Powergen apparently uses ORCA to interface with Powerbuilder.

Symbolic Links to the rescue

When I first tried using PBOrca to build code in PB 12.5, I wasn’t sure if it would work, since 12.5 wasn’t in the support list. I decided  to try posing PB 12.5 dll as 10 dll with the help of, you guessed it, Symbolic Links. I created a symbolic link named pborc100.dll pointing to pborc125.dll. Bingo, I was able to connect to and build PB 12.5 code. Get it? The software thinks it’s still loading to PB 10.0 DLL (the link PBORC100.dll, which indirectly invoked PBORC125.dll!). You could do this magic to some directory renames as well. I mentioned about Repository pointing to 2 different versions in my other post.

(Though, in all fairness to PBOrca, it actually worked with PB 12.5 dlls fine, but didn’t try that initially. All I had to was change the dll name in session statement).

Next time Symbolic link came to the rescue, was when I wanted to test Powergen build process with PB 15. When I did my beta testing, I had scripts setup for me to switch from 10.2 to 12.5 (See here). I wanted to reuse these scripts, without much changes. Unfortunately, Powergen does not know, PB 15 exists yet.  After some thinking, realize symbolic link could help me here. I just created a symbolic link for a PB dll used by Powergen. The symbolic link posed the PB 15 dll as a PB 12.5 dll. This worked!!! I was able to build a PB 15 version of the application using Powergen 8.5, which doesn’t naturally support PB 15 yet.

In both the above cases, posing one version of DLL as another worked only because, there wasn’t major changes to the DLLs themselves across the version. Otherwise, I would have gotten some compile or linker error.

Note: We have paid full license fee for Powergen upgrades. The hack I did was to make it work, was for test only. Please do not construe this as way to avoid licensed upgrades.

How Windows 64-bit Supports 32-bit Applications

A sharp and clear explanation on how Windows 64-bit supports 32-bit applications. You will get a full picture after reading this article.

via How Windows 64-bit Supports 32-bit Applications.