Create normal and admin taskbar shortcuts for the same program (e.g. cmd.exe) in Windows 10

Published 2019-09-21, 20:27

On my new Windows machine I try to use the package manager Chocolatey to install all programs. As it requires an administrative cmd.exe or PowerShell, I had the problem of wanting two shortcuts in my taskbar – one for installing programs, and another one for then using the command line normally.

This unfortunately is not as easy as it sounds, as if you just try to create a second shortcut by searching for the program, then using right click to „pin to taskbar“ it will recognize a shortcut already exists and only allows you to remove it – no matter if you changed it to run as administrator or not.

Fortunately you can work around that: Create a new shortcut manually (for example on your desktop), point it to cmd.exe /k and name it „Command Prompt (Admin)“ and then pin that to the taskbar additionally to the existing one. The param is standard anyway (as far as I know – no negative side effects observed until now), but it will make the shortcut different enough for Windows letting you do that.

Topic(s): Kram, Notiz No comments - :(

How to stop Windows 10 from going to sleep after locking it with Win+L

Published 2019-05-10, 13:14

Recently my Windows 10 machine started to go into sleep mode shortly after I locked it with the Windows + L keys. This was new behavior, and after realizing what was happening I googled a bit to find a solution:

https://superuser.com/a/1186786/25933

(As usual, this post is a not to myself so I can easier find this in the future.)

Topic(s): Kram No comments - :(

Notes on iTMSTransporter (autoupdate)

Published 2019-03-07, 16:29

Topic(s): Kram No comments - :(

Proxy iTMSTransporter traffic on Windows

Published 2019-03-07, 16:26

  1. Install iTMSTransporter on Windows
  2. Install your proxy application, e.g. Charles Proxy
  3. Use Java’s keytool to add the Charles Root Certificate to your Java installation
    • to add: keytool -import -alias charles -keystore ..\lib\security\cacerts -file c:\root.cer (password: changeit)
    • to check: keytool -list-keystore ..\lib\security\cacerts (same password)
  4. Execute the iTMSTransporter command with the proxy parameters: iTMSTransporter.cmd -m diagnostic -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8888 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8888 (via)
    • Depending on the command you might have to change the transport via -t DAV
  5. Make sure SSL proxying is enabled for the relevant Apple domains (probably contentdelivery.itunes.apple.com and itmsdav.apple.com)
  6. Profit?

Topic(s): Kram No comments - :(

How to reload environment variables (including PATH) in Windows Command line / cmd.exe

Published 2019-01-23, 18:30

Do you know all those installation instructions that tell you to restart your Windows console after installing a tool that adds itself to your PATH so its binary can directly be called?

Well, today I learned there is a much easier way to achieve this:

refreshenv
>refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..

Thanks to meteor for telling me about this in its Chocolatey/choco output:

Environment Vars (like PATH) have changed. Close/reopen your shell to see the changes (or in powershell/cmd.exe just type `refreshenv`).
Topic(s): Notiz, Windows No comments - :(

How to change the color scheme of Windows Command Prompt / cmd.exe

Published 2019-01-23, 16:37

Last week we announced the exciting news that Windows Console has a new default color scheme, and also promised you that we would release a tool to make it easier to change the console to your desired scheme. The Windows Console team is proud to present the ‚Colortool‚ which you can use to apply the new default color scheme, and several alternate pre-defined color schemes or even schemes of your own!

https://blogs.msdn.microsoft.com/commandline/2017/08/11/introducing-the-windows-console-colortool/

Download from https://github.com/Microsoft/console/releases, unzip to folder that is in your PATH environment variable, use via colortool solarized_dark for example.

Topic(s): Link No comments - :(

TIL: How to Fix a Slow-Opening Windows Downloads Folder

Published 2019-01-22, 15:10

Opening my Downloads folder from Firefox or Chrome always was slow. Reaaaaaally slow. So finally I googled „opening downloads folder from firefox is slow“ and found this short article, the explains a simple and perfectly fine solution:

https://www.laptopmag.com/articles/slow-windows-downloads-folder

Yay!

Topic(s): Link 1 single comment - :/

npm link: What the first `npm link` really does and how it can also be used

Published 2018-11-28, 13:39

There are loads of articles about npm link, how it works (npm link in library dir, then npm link library in project that should use that local library as a dependency) and what it can be used for (linking to a local folder for a dependency instead of having a npm downloaded version in node_modules).

But most skip over or only scrape what the first of the two steps really does – and how that can be used besides the default use case.

TLDR: npm link not only creates a symlink to the library in the global node_modules (that can be used in the second step of npm link ...), but also makes the library main script or binary accessible via a global npm module, similar to what happens when you npm install -g something.

The details:

When you run npm link as the first step of the two-step linking process, you create a „symlink in the global folder„.

Let’s follow the individual sub steps:

C:\Projects\Cordova
λ npm list -g --depth=0 
C:\Program Files\nodejs
+-- npm@6.4.1

We start in a specific folder (C:\Projects\Cordova in my example) and check our globally installed packages: We have nothing besides npm installed on this machine.

C:\Projects\Cordova              
λ cd cordova-paramedic 
 
C:\Projects\Cordova\cordova-paramedic
λ npm link
removed 1 package in 3.649s
C:\Program Files\nodejs\cordova-paramedic -> C:\Program Files\nodejs\node_modules\cordova-paramedic\main.js
C:\Program Files\nodejs\node_modules\cordova-paramedic -> C:\Projects\Cordova\cordova-paramedic

Now we switch the directory of our library that we want to link, cordova-paramedic here. We run npm link which creates two symlinks:

  1. C:\Program Files\nodejs\cordova-paramedic -> C:\Program Files\nodejs\node_modules\cordova-paramedic\main.js
  2. C:\Program Files\nodejs\node_modules\cordova-paramedic -> C:\Projects\Cordova\cordova-paramedic

The first one is a symlink for the „binary“, the main script, of our library.
The second is a symlink for the whole library into the global node_modules.
(C:\Program Files\nodejs\ is our global node/npm folder on this machine)

That first symlink is not mentioned in most of the articles about npm link on the web as the example libraries being linked don’t include a main script in their package.json.

λ npm list -g --depth=0
C:\Program Files\nodejs
+-- cordova-paramedic@0.6.0-dev -> C:\Projects\Cordova\cordova-paramedic
`-- npm@6.4.1

When we check the globally installed modules again, we see that our library was added to that list.

So not only can we now use npm link cordova-paramedic, the second command in the npm link two step process, to add this library to any project from our local checkout – but we can also use it as a global command cordova-paramedic!

C:\Projects\Cordova
λ cordova-paramedic
Error missing args.
...

So using npm link you can not only link local development versions of libraries to use in another project, but you can also create a global command that uses a local version of your command code. This is very useful when developing such a library.

Topic(s): Development No comments - :(

Android Emulator: PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value

Published 2018-11-16, 17:38

Debugging and fixing a broken Android SDK setup is always „fun“ – especially on a CI environment where you don’t control the actual installation.

It gets worse when all the StackOverflow answers and other Google results for the error you are getting are basically „I executed some slightly related, but otherwise random commands, and after that it worked“.

In my specific case I was getting this error message when trying to start an Android Emulator:

PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value

It was really hard to find out what „AVD system path“ actually meant and how my ANRDOID_SDK_ROOT could be connected to that.

So to maybe make this search a bit easier for future people having this problem, I write a solution down here:

Continue reading Android Emulator: PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value…
Topic(s): Development, Link No comments - :(

How to create an empty file in cmd.exe / Windows Command Line

Published 2018-11-14, 16:45

copy NUL EMptyFile.txt
copy /b NUL EmptyFile.txt

 https://stackoverflow.com/a/1702790/252627

Topic(s): Kram No comments - :(

13 queries. 0,126 seconds.