Category Archives: Windows

Copy putty (ssh) sessions to new/other computer

I’m a huge fan of putty – available for download at: Download PuTTY: latest release (0.78) (greenend.org.uk)

Over time, I tend to accumulate a large number of saved “sessions” that I find it useful to either move to a new computer, or save/backup. He

regedit /ea c:\Users\mark\dropbox\_mark\puttycopy.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY

Copied that puttycopy.reg to the new drive/computer.

To add the saved sessions, just double clicked on that .reg file on the new computer.

Issues running npm & WSL2 (bad interpreter)

I started a new project and wanted to use node/npm inside of WSL2. However, when I tried to run npm inside of either Ubuntu 18 or 20, I got this error message:

mark@LAPTOP:~$ npm
-bash: /mnt/c/Program Files/nodejs/npm: /bin/sh^M: bad interpreter: No such file or directory

After a whole lot of searching, I came across this web page, https://stackoverflow.com/questions/63716587/in-wsl2-ubuntu-20-04-for-windows-10-nodejs-is-installed-but-npm-is-not-working which suggested updating the ~/.bashrc file to look like:

# strip out problematic Windows %PATH%
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')

I added that to the VERY end of the file, and rebooted.

The next time I tried to run npm, I got this successful message instead:

mark@LAPTOP:~$ npm

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    /home/mark/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@6.14.4 /usr/share/npm

WSL2 – Adding distro not in store

What if you wanted to add an older linux distro to your WSL2 bullpen? Visiting https://docs.microsoft.com/en-us/windows/wsl/install-manual#installing-your-distro will show you a large number of options where you can download the appropriate .appx file.

This will cause the <distro>.appx packages to download to a folder of your choosing. Follow the installation instructions to install your downloaded distro(s).

If you’re using Windows 10 you can install your distro with PowerShell. Simply navigate to folder containing the distro downloaded from above, and in that directory run the following command where app_name is the name of your distro .appx file.PowershellCopy

Add-AppxPackage .\app_name.appx

If that doesn’t work as expected, you could try any of these links that will get the distro from the Microsoft Store

he following links will open the Microsoft store page for each distribution:

Upgrade powershell

If you sign into PowerShell and you get this message:

A new PowerShell stable release is available: v7.0.3
Upgrade now, or check out the release page at:
https://aka.ms/PowerShell-Release?tag=v7.0.3

Here’s what you’ll want to do to install the upgrade

Invoke-Expression "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"

After downloading for a while, you should get the PowerShell Setup Wizard.

Hit the Next button a few times, checking the options as you go along, then click the Install button., and continue w/ the install process. I had a problem with a running ‘pwsh’ so I chose the option to: “Do not close applications. A reboot will be required.”

Belarc Advisor – Find Installed Software License Keys

You know the feeling when you are trying to reinstall software on a computer…you’ve done it many times…but all of a sudden you can’t find the original DVD with the software key printed on it?

Yup.  M e too.

Belarc Advisor (http://www.belarc.com/free_download.html) to the rescue.  It will tell you the licenses of software already installed on the computer.

It also tells you a whole lot about your computer’s system: disk space, memory, etc.

Delete partitions on Drives (USB especially)

Microsoft DiskPart version 6.2.9200

Copyright (C) 1999-2012 Microsoft Corporation.
On computer: COMPUTER

DISKPART> list disk

Disk ### Status Size Free Dyn Gpt
——– ————- ——- ——- — —
Disk 0 Online 298 GB 0 B
Disk 1 Online 7509 MB 6619 MB

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> exit

This info was copied from: http://geekswithblogs.net/ilich/archive/2013/04/26/recovering-unallocated-space-of-a-usb-flash-drive.aspx

Using xcopy to safely copy (and verify) files from one drive to another

I recently upgraded my “data” drive from a 3TB to a WD Black 6TB Performance Desktop Hard Disk Drive – 7200 RPM SATA 6 Gb/s 128MB Cache 3.5 Inch drive.

Once I had both drives installed in the computer, it was time to copy data.

Head over to: Start Menu -> All Programs -> Accessories -> Command Prompt. Right click on it, and choose “Run as administrator”


xcopy f:\ e:\ /f /h /i /j /o /s /v /x 1>>c:\xferlog.txt 2>&1

Continue reading Using xcopy to safely copy (and verify) files from one drive to another