Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Friday, 16 January 2009

How do I clean up my log files?

Create a scheduled task that will execute the following command:

C:\WINDOWS\system32\forfiles.exe /p C:\logs /s /m *.log /d -7 /c "CMD /C del @FILE"

This example recursively deletes "*.log" files older than 7 days. If you simply wanted to move the files, change the comannd parameter - this provides a nice way to archive.

For further information, see the Forfiles documentation.

Friday, 4 April 2008

Windows - Hosts

The hosts file can be used to map IP addresses to host names. Each entry should be on an individual line with the IP address in the first column and the host name in the second (separated by at least one space). Lines can be commented by placing a # at the beginning. The hosts file can be find in C:\Windows\system32\drivers\etc. To see the effects of any changes, you'll need to restart or create new instances of the browser(s) or run the following from the command line:

ipconfig /flushdns

Example:

127.0.0.1    test
Subsequent requests for http://test will then point to 127.0.0.1 (local).

Windows - Map local folders

Network locations can be mapped pretty easily but mapping local folders is more complicated. Run the following from the command line:

subst {drive}: {directoryPath}

This example shows how to map C:\Windows to the W drive meaning that I can reference anything in that directory like W:\{directoryPath}\{fileName}.


Example:
subst W: C:\Windows

Tuesday, 18 March 2008

gacutil is not recognized as an internal or external command, operable program or batch file

Sometimes, you want to run gacutil from the command line:

gacutil /i {assemblyPath}

On some computers (depending on the installation), you might get the following error message:

'gacutil' is not recognized as an internal or external command, operable program or batch file

You'll need to download and install the Visual Studio 2005 SDK. Included in the SDK is gacutil.exe. In order for Windows to recognise the gacutil command, you'll also need to modify the Path variable (Environment Varabiables). Simply add the location of the executable which is normally:

C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin

Remember to include a semi-colon before adding the folder location.