Windows .bat file command line tool, wait for keypress when double-clicked

Windows .bat files can be a convenient and quick way to automate things, like, for example, a compilation command involving a lot of options. They can be executed from the command line or by double-clicking them from the explorer. In the latter case, one would want the script to wait for a keypress until they close the window. When started from the command line, the waiting from a keypress is rather annoying.

It is possible to make the script behave differently depending on the way it was executed:

IF /I %0 EQU "%~dpnx0" PAUSE

This executes the PAUSE command when the file was started by double-click.

Source: Detect if bat file is running via double click or from cmd window

Starting a local Webserver for Testing

Easiest way is to open a console window in what you would like to have as root directory of your webserver and start

python -m http.server

Then, by serving to http://127.0.0.1:8000 you will be able to view and browse the contents.

To specify a port, just add the port number to the command, for example

python -m http.server 9999

Please not that this webserver does not support https, so you have to enter the URL with a starting http:// and you might have to click away a browser warning because of the unsecured site.

Therefore, only use this for local testing!

Making Screenshots under Windows

To copy a screenshot of the active window into the clipboard: Alt + PrntScrn (Alt + Druck on a German keyboard) Note that the clipboard will be overwritten, so if you want to take two screenshots, you have to paste the first screenshot before taking the second one.

To copy the whole screen into the clipboard: PrntScrn (Druck on a German keyboard)

To make a screenshot with customized clipping, press Winkey + Shift + S.

To save a screenshot of the active window: Alt+ Winkey + PrntScrn (Alt + WinKey + Druck on a German keyboard) The image will be saved in PNG format into the folder Videos\Captures (Videos\Aufzeichnungen on a German Windows)

To save a screenshot of the whole screen: Winkey + PrntScrn (WinKey + Druck on a German keyboard) The image will be saved in PNG format into the folder Pictures\Screenshots (Bilder\Bildschirmfotos on a German Windows)

While it is crazy that two different folders are used for saving the images, other than that the shortkeys are a convenient method to quickly obtain and save screenshots.

When Windows 10 search suddenly stops working

The search function is a very convenient thing – you press the windows key and start typing, getting displayed the apps or files of interest as you type. For me this feature suddenly stopped working. A renew of the search index, as recommend on several sites did not solve the problem. The troubleshooting program of Windows identified a problem with folder access rights, but this was not the problem. The reason was that the search service was not started anymore for some reason, this might have happened at one of the past updates.

After having the problem identifed, issueing the command searchIndexer.exe /Embedding in an elevated console solved the problem for good.

Fix DPI scaling issues in Windows

If you have a computer with an awesome hi-res display (mine is 3840 x 2160) you might know the problem: some older application don’t follow the DPI upscaling setting of Windows, which makes them in practise unusable.

To fix this issue, you can tell Windows to manually scale up some particular applicatons. To do this, you must first find the place where the application file is located, for example by right-clicking on the program in the start menu:

step1-findfileThen enter the properties page of the file with another right-click:

step2-filepropertiesand tell Windows in the compatibility tab to do the scaling instead of asking the application to do it:

step3-DPIcompatibility

filegive: send and receive files across computers

filegive easily sends or receives files point-to-point, with authentication and ciphering, and the other side only needs a Web browser. No third party server is involved in the transfer. It can use common NAT traversal protocols like uPnP and NAT-PMP, manually forwarded ports, or a public ssh server.

filegive is a commandline tool available for Linux, Windows and Mac OS.

Project page with commands and download links

Connection from Mac OSX Mavericks to Windows

Solution provided by Prof.Bettstetter:

After installing OS X Mavericks on a Mac, you can no longer connect from this Mac to a Windows share.

Solution:

On the MAC: System preference (Systemeinstellungen) -> Sharing (Freigabe) -> File Sharing (Dateifreigabe) in the left side vertical bar -> Options (Optionen). Read the note about „Windows-Dateifreigabe“ and chose the user of your choice.

You may also test to uncheck the Share files and folders using SMB and check the Share files and folders using AFP checked.

See https://discussions.apple.com/message/23470245#23470245

Missing fonts when starting X-application on Linux

Recently, I got the following error message when I tried to start an X-application under Linux:

Some fonts seem to be missing in your system, you should install either xfonts-100dpi or xfonts-75dpi and then restart Xorg to get xboard running.

I got this error message despite having the packages xfonts-100dpi and xfonts-75dpi installed. After scratching my head for some time I found the problem: I was running the application via ssh with X-forwarding from a Windows PC. And the Xserver was actually running on Windows, namely the Xming application.
The problem was quickly fixed by downloading the font packages from the Xming page.