Archive for the ‘Development Tools’ Category

How to generate random numbers in a batch file?

November 22, 2008 7 comments

Ever wondered how we can generate random numbers in a batch file. Yes, I am talking about our good old faithful friend ‘.bat’ file. Why do I need one? You may ask! I had to generate a unique filename everytime because I had to backup a folder before I updated it.

So tell us is there one? Yes use ‘random’, it’s a built in command which generates a random number when you invoke it. Every time a unique one! So if you type in ‘random’ at a command line and then press enter, you’ll get an error because it’s not an independent executable, but a feature that is built into command prompt to help generate random numbers. So how will I get a random number? This is how I do it…

echo %random%

Make a random directory….

mkdir C:\Nibu_%random%

If Command Extensions are enabled, then there are several dynamic environment variables that can be expanded but which don’t show up in the list of variables displayed by SET.  These variable values are
computed dynamically each time the value of the variable is expanded. If the user explicitly defines a variable with one of these names, then that definition will override dynamic ones like %random%.

For more information type “set /?”

To enable command extensions open up regedit and then navigate to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\EnableExtensions
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

and set value to 1. If not present then add one REG_DWORD value with an identical name and value set to 1.

Resource Digger

July 31, 2007 2 comments

It’s basically a resource hacker. Useful for digging up dlls and exe’s to find out the resources in them. Loads any number of them. It’s not yet fully functional but you can use it.

Only Load Folder, Load File and remove all works plus drag and drop, drag a complete folder and drop on this application, all valid modules from the folder will be loaded. Shortcuts doesn’t work. I will update it as soon as I do get time. Have a nice time digging resources. :))

Download the Resource Digger from here…

Resource digger exe file ( Rename to exe ) Right click and select “Save target as”.

A screenshot of how it looks…

Dependent dll listing?

To see all dependent dlls for an exe or a dll use

dumpbin /dependents SomeDll.dll

dumpbin /dependents SomeExe.exe

Disassembling a dll or exe

Use dumpbin…

// Disassemble a dll
dumpbin /disasm SomeDll.dll > RedirectToSomeFile.asm

// Disassemble an exe
dumpbin /disasm SomeExe.exe > RedirectToSomeFile.asm

Redirecting to a file, results in faster disassembling.

Help for dumpbin displays the following information!

Microsoft (R) COFF Binary File Dumper Version 6.00.8447
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

usage: DUMPBIN [options] [files]

Using dumpbin we can also list out the import table and export table of a dll or exe. An e.g.

dumpbin /EXPORTS %systemroot%/system32/user32.dll

Try out all those options 🙂

SysInternals Product Suite

Categories: Development Tools Tags:
%d bloggers like this: