Archive | April 2010

Rename file using date

I need this code so that my log file is not getting bigger and bigger each time and I can manage my logfile per day. This is the windows command to rename a file to use a date format:

ren test.txt test_%date:~10%-%date:~4,2%-%date:~7,2%.txt

The command will rename the file to test_2010-04-30.txt

To add the TIME format:

ren test.txt test_%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%.%time:~3,2%.txt

The command will rename the file to test_2010-04-30_16.21.txt

Enable / Disable Hibernate on Windows 7

I’m using windows 7 enterprise. Hibernate use hiberfil.sys file to store memory (RAM). So the size of the hiberfil.sys file is the same with the size of the memory (RAM). If you don’t use this hibernate feature, it’s recommended to disable this feature because you can save disk spaces.

To enable hibernate:

  1. open cmd as administrator (right click on cmd icon and select run as administrator).
  2. enter command: powercfg -h on and press Enter.

To disable hibernate:

  1. open cmd as administrator (right click on cmd icon and select run as administrator).
  2. enter command: powercfg -h off and press Enter.