Tag Archives: Windows

Shortcut to Resource Monitor in Windows 8.1

In Windows 7 there was a shortcut to Resource Monitor in the start menu, which meant you could launch it quickly through search. In Windows 8.1 this didn’t seem to be the case for some reason. Might have missed something… but found the shortcut for it on a Windows Server 2012 installation, and it worked just as nicely in Windows 8.1. So, note to self:

%windir%\system32\perfmon.exe /res

So after quickly making a shortcut to that in my menu, I’m once again back to launching it directly rather than through the button in Task Manager.

Change license key of Windows Server

Needed to install two Windows Server 2012 R2 instances today, but didn’t have a valid production license key yet and didn’t seem like there was a way to skip the key in the setup. Found you can remove a license key using a command, so worked around it using a temporary dev key from MSDN for the installation and then removed that key afterwards. For future self-reference, here’s how…

  1. Open elevated command prompt
  2. To remove key
    > slmgr -upk
  3. TO add new one
    > slmgr -ipk NEW-KEY or use regular activation process

Touching files in Windows

In Unix you have the touch command which you can use to update a files timestamp. No such thing in Windows. But instead, apparently, one can do this:

REM Updates the timestamp of the file
copy /b filename.ext +,,

REM Creates a new empty file
echo $null >> filename.ext

If you need it more than seldom there are also some more tricks in the StackOverflow sources below.

Sources:
Windows equivalent of the Linux command ‘touch’?
Equivalent of Linux `touch` to create an empty file with PowerShell?

Change network profile name and type in Windows 8

The Network and Sharing Center in Windows 8 is kind of useless in many ways. There is for example no way to change the name, so you might be stuck with a dumb “Network 3” identity. There’s also no way to change between the Public and Private types if you want to change what you selected when you initially connected to the network.

So, on your own responsibility, here’s where to find those profiles in the Registry Editor.

  • HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\Windows NT \CurrentVersion \NetworkList \Profiles

Of particular note is the ProfileName and the Category. The last one can have the following values:

0

Public
1

Private
2

Domain

BAT: Change working directory to directory of script

Sometimes you want a batch file to always run with the directory of the script as the working directory. Not whatever directory you ran it from.

@echo off
pushd %~dp0
do stuff
popd

Here pushd changes the directory to %~dp0, which is the directory of the running batch script. popd returns to whatever it was when the script started running. Not sure if the last step is necessary, but there you go anyways :)

What’s keeping my Windows computer awake

Just discovered a very simple way to find what’s keeping my Windows computer awake or my screen from going black.

  1. Open up an elevated command prompt.
  2. Run the following command
    > powercfg -requests

While playing a video in Windows Media Player I get this output:

DISPLAY:
[PROCESS] \Device\HarddiskVolume2\Program Files (x86)\Windows Media Player\wmplayer.exe

SYSTEM:
[DRIVER] High Definition Audio Device (HDAUDIO\FUNC_01&VEN_10EC&DEV_0888&SUBSYS_1458A102&REV_1000\4&1454c4ac&0&0001)
An audio stream is currently in use.
[PROCESS] \Device\HarddiskVolume2\Program Files (x86)\Windows Media Player\wmplayer.exe

AWAYMODE:
None.

EXECUTION:
None.

PERFBOOST:
None.

Simple and clear!