Switch off safe boot if you cannot boot into it

Recently I run into problems with my NUC5 mini PC running Windows 10. I activated safe boot mode in msconfig, as it is recommended on some sites.

But, as it later turned out, is not the best and therefore not the recommended way. Because I run into the problem that my 26″ Monitor could not display the low resolution of the safe boot. At that point in time I only big monitors around.
And since I had activated the safe boot via msconfig a simple rebooting was of no use – since the computer started every time in safe mode and the display stayed black leaving me without an option to disable the setting.

I had a hard time to figure out how to switch this option of without reinstalling Windows from scratch – which I wanted to avoid.
Luckily the Windows DVD was helpful. I booted into the Windows 10 installation DVD and started the command line and succeeded to disable the safe boot mode using bcedit.

Usually the following command does the trick:

bcdedit /deletevalue safeboot

But it was not so easy in my case since I had multiple boot configurations setup.
In such a scenario you have to find the identifier of your spoiled boot configuration.
To do so, run:

bcdedit /v

Not the id of the configuration you have set to safe boot and delete the value:

bcdedit {xyz123} /deletevalue safeboot

Done. Close the command line and reboot normal.

Delete all files smaller than x bytes size

This is more or less a reminder to myself, but could came handy for others as well.

I had a folder with 250k files, 80% are small files with 0-10k I wanted to delete.
The easiest thing that comes to mind in such a case: Sort the files by size in the Explorer and hit SHIFT + DEL.
The sad thing is, it does not work (or at least takes ages..)

In such situations is time to turn to the command line.

1. Deleting all smaller files than x with Cmd:

Move to the directory of choice and execute the following command to delete all files smaller than 2kb. Warning! Use with care and on your own risk!

@for /f  “dir /b *.HTM” do If %~zA LSS 2048 del %A

This works fine, if you suppress the output.
If you run it without the @ it is very slow.

2. Deleting all smaller files than x with PowerShell:

Move to the directory of choice (or define an explicit path instead of $path) and execute the following command to delete files smaller than 500kb.

Get-ChildItem $path -Filter *.html -recurse -file | ? {$_.length -lt 512000} | % {Remove-Item $_.fullname -WhatIf}

If you remove the -WhatIf parameter, and the command deletes for real, after you have tested to make sure the code removes the files you want. Again: Warning! Use on your own risk!

3. Count of all files in (current) directory

Since we are already here, we might also want to know how many files before/after in the directory (Explorer at least can handle this quite well).

(Get-ChildItem C:\Scripts).Count

or if we want to filter for a specific file type:

(Get-ChildItem C:\Scripts -filter “*.txt”).Count

Cmd can do this too, but again it can be slow:

dir /b /a-d | find /c /v “”

Here is a SO article that has some more suggestions how to delete files less than a specific size: https://stackoverflow.com/questions/6764621/delete-files-less-than-a-specific-size

Launch UWP apps via URI Scheme

If you ask how to launch a UWP app from the command line, you have to learn new ways.

The common way to launch a UWP app is

Protocol activation via URI

There are a number of built in URIs to launch the default app for things like mailing, etc.

URI Scheme Launches
bingmaps:, ms-drive-to:, and ms-walk-to: Maps app
http: Default web browser
mailto: Default email app
ms-call: Call app
ms-chat: Messaging app
ms-people: People app
ms-settings: Settings app. You can also jump to specific areas, like ms-settings:privacy-webcam
ms-store: Store app
ms-tonepicker: Ring/Alarm Tone picker
ms-yellowpage: Nearby Numbers mobile app
ms-clock: Alarm/Clock (does not work for me)
ms-actioncenter: Action/Notification Center
ms-cortana Cortana
onenote: Default Onenote app
xbox-tcui: Xbox app
ms-cxh: Microsoft Account Profile
microsoft-edge: Edge Browser
read: Edge Reading View (does not work for me)
bingnews: Bing news app

Launching a modern app from the command line

To start the corresponding default app from the terminal (cmd.exe) precede each URI command with start, like this

  >start microsoft-edge:

You can also right-click on the Start button, choose Run (or press Win+R), enter the URI command (without preceding start), and press Enter.

Run-ms-clock

Apart from command line junkies, protocol activation is most useful in your own handmade apps. Because your app can’t select the app that is launched. If there is no app installed to handle the given URI, you can recommend an app for the user to install. For more info, see Recommend an app.

Protocol activation should also work for most 3rd-party apps. If you know the declared (metro/uwp) app name, you can launch the app like this:

twitter:

wunderlist:

Sad to see that some apps have wired internal names like test_uwp_app123:

To use protocol activation for your own app read: Automate launching Windows 10 UWP apps

Many apps also accept additional URI parameters like mailto:your@email.com?subject=Important message
or bingmaps:?cp=40.726966~-74.006076

Alternatives

If this does not work for a specific app, there are some alternatives:

GUI automation with VBS

Someone on stack overflow suggested here to use a VB-Script to automate the UI. It’s kinda ugly, but maybe still useful.

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.SendKeys "^{ESC}"
WScript.Sleep 1000
objShell.SendKeys WScript.Arguments.Item(0)
WScript.Sleep 1000
objShell.SendKeys "{ENTER}"

Save this to a vbs script, let’s say metrorunner.vbs and run in command line:

>metrorunner.vbs store

Create a Desktop Shortcut

Another option is navigating to the (Modern) App Folder and create a regular Shortcut on your Desktop, as described here.

Win+R: shell:AppsFolder

Then, pick the app you want, right-click, select create a shortcut, and you will be asked if you would like to create one the Desktop.

Not bad. I have to admit I like that special folder for reference purpose, since is gives you an overview of all your installed apps.

That’s all for now.