Tinram / Windows-Survival

Survival cheatsheet when forced to develop in Windows World.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows Survival

Survival snippets for development on Windows.

Developing on Windows?!

Despite detesting so much of this wretched OS, I am sometimes forced to use it for on-site work.

This is a quick personal reference to work around some of the pain of Windows world.



Active Directory

Corporate environments love Active Directory (AD). I don't.

AD periodically copies files from My Documents and adds them to a remote network server(s).

For corporate PC roaming file access you might want this, else you probably won't.

If not, move personal files out of My Documents to another location, such as C:/mydocs

– which will then rely on your backup schedule, not AD's (not that I found AD's consistent anyway).

Clean-up

  • CCleaner

  • C:\Users\<username>\AppData\Roaming\

  • C:\Users\<username>\AppData\Roaming\Skype\<skype_name>\xxxx-journal

  • putty -cleanup (wipe session data)

Command-Line

For a resized terminal window on Windows < 10

    mode con cols=140

Change encoding:

    chcp 650001        Unicode
    chcp 1252          Latin 1

Open terminal in current folder:

  • current directory (nothing selected) > Shift + right click > Open command window here

Registry hack:

  • Windows + R > regedit
  • HKEY_LOCAL_MACHINE\Software\Classes\Folder\Shell\
  • create new key called Command Prompt
  • default value: cmd
  • create new key below Command Prompt called Command
  • default value: cmd.exe /k "pushd %L"

Commands

A few network and file commands.

command description
comp compare two files
fc file contents compare
find text string in file /n line nums, /c line count
findstr string search in file findstr /si password *.txt
fsutil file utils fsutil file createnew <f> 1024 null chars
getmac MAC address
hostname
ipconfig IPs
more pager
mstsc RDP
net network info
netsh netshell netsh interface ip set address local dhcp
netstat network stats -a all, -b exes, -o owner, -p TCP, -r routing, -s stats
net use network connections
path search path
pathping network ping stats
ping
ren rename
route routing table
sort sort text -r reverse
start exe or cmd
systeminfo
taskkill
tracert
tree dirs tree /F /A
type view text file
unzip
where file locator
xcopy file / dir copy

/dev/null

A bitbucket

p = program

    p > nul
    p 2> nul             error to nul
    p > nul 2>&1         error + out
    p >f 2> nul          out to file, suppress error
    (p) > f 2> nul       out to file, suppress cmd.exe error

Editors

Just don't use Windows Notepad, which has one level of undo and no recognition of non-CRLF line endings. (Probably just fine on Windows 1.0 in 1985.)

Diff Folders

    ROBOCOPY cmp cmp2 /e /l /ns /njs /njh /ndl /fp /log:diff.txt

Drive Mapping

\\10.0.0.147

Essential Programs

Standalone Programs

Add standalone programs to C:/<directory>, and add this directory location to $PATH, so the programs are available on the command-line from any location.

File Transfer

Easy Way

Win 10

  • ssh, scp

Win 7

  • local server upload, netcat, WinSCP, network storage, online storage ...

Hard Way

Win 7

  • Network and Sharing Center, enable:
    • network discovery
    • file and printer sharing
    • public folder sharing

Win XP

  • Windows + R > services.msc > Server, Computer Browser (required)
  • Firewall > exceptions > File and Printer Sharing > enable

Keys

Windows + ...

keys purpose
Alt + PrtScrn screenshot of active window
Break system properties
E Explorer
F3 file search
L lock
M minimise windows
P projector
R run
R Ctrl + Shift + Enter = admin
Shift + L-Alt + PrtScrn high contrast

Others

keys purpose
Shift + right click open terminal
F2 rename
F3 search
F5 refresh
Alt + TAB cycle windows
Alt + Shift + TAB cycle backwards
Ctrl + Shift + ESC taskmanager

Hosts

C:\windows\system32\drivers\etc\hosts

Create shortcut:

  • Windows + R > notepad /A <path>
  • right click > Run as administrator

.msc

.msc description
compmgmt.msc computer management
devmgmt.msc device manager
diskmgmt.msc disk manager
eventvwr.msc event viewer
fsmgmt.msc shared folders
gpedit.msc group policy
lusrmgr.msc local users / groups
ntmsmgr.msc removable storage
ntmsoprq.msc "
perfmon.msc performance
secpol.msc security
services.msc services
wf.msc firewall
wmimgmt.msc WMI

.cpl description
nusrmgr.cpl user accounts
firewall.cpl

Passwords

Windows + R > rundll32.exe keymgr.dll,KRShowKeyMgr

Power Configuration

Windows + R > regedit

HKEY_CURRENT_USER\Control Panel\PowerCfg > CurrentPowerPolicy
    0  home office
    3  always on
    4  minimal management

(Win 7 Pro: bugs prevent the above working.)

Program Installation Folders

(theoretical, Windows doesn't usually care)

\Program Files (x86)\     x32
\Program Files\           x64

sendto

%APPDATA%\Microsoft\Windows\SendTo

or

Windows + R > shell:sendto

Servers

  • WAMP

    • x64, x32, multiple PHP versions
  • XAMPP

    • x32, ancient PHP versions available

IIS Conflict

Kill IIS when it stops WAMP / XAMPP:

  • Control Panel > Admin Tools > IIS Manager > stop
  • Windows + R > services.msc > Web Deployment Agent Service > manual start

Services

  • DCOM Server Process Launcher: defragging
  • Diagnostics Tracking Service: telemetry

Start Batch

  1. start.bat
    @echo off
    start cherrytree.exe
    start firefox.exe
    exit
  1. add the program locations in start.bat to $PATH

Taskbar

Thumbnail Preview Disable

  • Windows + R > gpedit.msc > User Configuration > Administrative Templates > Start Menu and Taskbar > Turn off taskbar thumbnails > Disabled

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced new DWORD > ExtendedUIHoverTime > 30000

(Both disabled by Win 10 Creators Update ... sigh.)

Telemetry

Win 10

  • Start > Settings > Privacy
    • disable as many as possible, especially Inking

Disable Services

  • DiagTrack
  • Connected User Experience and Telemetry

Disable via Registry

    sc delete DiagTrack
    sc delete dmwappushservice
    echo "" > C:\ProgramData\Microsoft\Diagnosis\ETLLogs\AutoLogger\AutoLogger-Diagtrack-Listener.etl
    reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection" /v AllowTelemetry /t REG_DWORD /d 0 /f

Updates

Win 7 Bad Updates

  1. disable Win 10 upgrade path:
  • HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate DisableOSUpgrade > 1

  • HKLM\Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade ReservationsAllowed > 0

  1. KB3133977, March 2016
    • prevents booting, looks like hard drive failure
    • remedy: disable UEFI secure boot; OS Type > Other OS

Borked Updates

Updates jammed / Updates Service disabled error

  • Windows + R > services.msc > stop WindowsUpdate
  • C:\Windows\ > rename SoftwareDistribution directory
  • Windows + R > services.msc > start WindowsUpdate

Windows

Unreachable Offscreen

  • right click window on taskbar, or select it and use Alt + Space
  • if Restore option available, select it to get window out of minimised/maximised state
  • Move
  • cursor
  • move mouse

Windows Explorer

Kill and Reboot

    taskkill /f /im explorer.exe
    start explorer.exe

License

Licensed under the MIT License.

About

Survival cheatsheet when forced to develop in Windows World.

License:MIT License