Windows notes

From raju

Note:- This page will be migrated to http://www.kamaraju.xyz/dk/windows_notes. Once the migration is done, it will be deleted.

Dummy

Fixed width fonts in outlook

Use consolas or courier

take a screen shot

To take a screen shot of a particular area

Start Menu -> Snipping Tool

edit files mapped via samba

When Samba mapping is used to edit files on a windows machines that were originally stored on Linux machine, I faced the following problems.

  • The executable bit is not set correctly. So, whenever a script is edited and saved on windows, I have to manually "chmod +x" it on Linux machine.
  • If a softlink is edited and saved on windows, the changes do not propagate to the original file. Instead, it creates a totally new file with the softlink's name.

move windows

Press alt+<space>m and then use arrow keys

tested on | windows 10 enterprise

google search | command line shortcut to move windows

Situation
I did not find the symphony chat window when I remoted into my work desktop that had two monitors. I used this shortcut to move the chat window to the active monitor.

default apps

  • Open .xml, .txt, .log files in notepad++

Modify the Alt+Tab behavior

Task: Make alt+tab show recent windows first and do not limit the behavior to just the first 6 windows.

Solution: http://superuser.com/questions/114001/getting-back-the-old-alt-tab-windows-switching-behavior-in-windows-7

Additional notes :

  • Once you go to
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
    right click and select New -> DWORD (32-bit) Value. When a new DWORD is created, the default value is set to 0. Right click on the DWORD -> Modify -> Value Data -> 1 . The Base can be left as Hexadecimal.

MS Word

  • short cuts
    • undo - ctrl-z
    • Redo - ctrl-y
    • remove table borders - Alt+hbn

External links


Terminal emulators in Windows

As of 2015-03-30, I am using Superputty. But here is a list of many terminal emulators I tried before converging onto Superputty.

putty

 Pros: very powerful, sessions can be stored, automated login by SSH key authentication
 Cons: no builtin xserver, can't have more than one terminal in a window. So if you want to connect to multiple machines, you have to open multiple putty sessions

superputty

  • Pros:
    • different putty windows can be placed in a single window
    • can import putty sessions
    • Upon restart all previous sessions are automatically restored.
    • Very easy to run a single command across all the putty connections made via superputty
    • Saving new layouts is easy. Restoring a saved layout is just a double click away.
  • Cons:
    • Has some bugs - Alt+tab and user defined key board shortcuts (ex:- ctrl+left, ctrl+right to do tab switching) etc., stop working all of a sudden. However, this Bug is unreproducible and only happens some of the times.

putty manager

  • Pros:
    • Can have multiple putty windows in the same window
  • Cons:
    • Development seems to be stalled. Latest release 0.2.16 dates back to 2012-12-10
    • After closing a session with two tabs containing different putty connections, if I try to restore it, the result is two putty sessions in the same window but one below the other. That is the program does not restore the layout of tabs correctly.

Alternative Windows Console

  • Pros:
    • Can have multiple putty windows in the same window
  • Cons:
    • Development seems to be stalled. Latest release 2.0.38 dates back to 2013-08-13
    • After closing a session with two tabs containing different putty connections, if I try to restore it, the result is two putty sessions in the same window but one below the other. That is the program does not restore the layout of tabs correctly. Moreover, in each putty window of the new session, the putty configuration dialog is displayed instead of automatically logging in to the machine.

mtputty

  • Pros:
    • Can have multiple putty windows in the same window
  • Cons:
    • If a session with multiple tabs is closed, it is not automatically restored.

conemu vs console2

https://aarontgrogg.com/blog/2015/07/31/a-better-windows-command-line-experience-comparing-powercmd-vs-console2-vs-consolez-vs-conemu-vs-cmder/ recommends conemu to console2, consoleZ and PowerCmd

Quickly launch applications

  • win+r excel
  • win+r notepad
  • win+r winword
  • win+e will launch the file explorer
  • win+r shell:startup - open startup folder in explorer.

Windows shortcut keys

  • Ctrl-Shift-Esc - Windows Task Manager
  • win+m - minimize all windows, win+M - restore them
  • win+shift+<up> - maximize window vertically, win+shift+<down> - restore the window or minimize
  • win+<up> - maximize window, win+<down> - restore or minimize
  • win+<left>, win+<right> - move window to left or right edges of monitor and maximize vertically
  • win+shift+<left>, win+shift+<right> - move windows between monitors
  • win+<pause|break> - show system properties
  • win+tab - fancy way to switch windows

Ref:

keyboard shortcuts to control windows

  • Win + Down - if active window is maximized, make it normal sized. If active window is normal sized, minimize it.
  • Win + Up - reverse of Win + Down
  • Alt+Space n - minimize a window
  • Alt+Space d - duplicate a window

Working with multiple windows

In Windows 7, multiple windows are grouped per application in the taskbar. For example, all google chrome windows are grouped under one button, all outlook windows are grouped under different button etc., Holding down the <CTRL> key and clicking on the group will bring up the last used window in that group.

tags | control key

Firefox configuration

  • Open a newtab -> click the configuration wheel -> New Tab Controls -> Show your top sites -> uncheck "Include suggested sites"

Q&A

Q. How to disable window maximization when title bar is dragged all the way to the top of the monitor and cursor touches monitor edge?

A. Control Panel -> Ease of Access Center -> Make the mouse easier to use -> Check Prevent windows from being automatically arranged when moved to the edge of the screen -> Apply -> OK.

Note that checking this box comes with many side effects.

  1. a maximized window cannot be moved to a different monitor by dragging the titlebar with mouse
  2. win+left, win+right keys no longer work

So choose your poison.

starting applications

Program name command shortcut tested on
Windows Task Manager taskmgr ctrl-shift-esc Windows 10 Enterprise
Windows Task Manager taskmgr ctrl-alt-del -> Start Task Manager Windows 7 Enterprise

git bash

Download it from https://github.com/git-for-windows/git/releases

set up HOME directory

system = windows 7 Enterprise

    Control Panel -> System and Security -> System -> Advanced system settings
    -> Environment Variables
    

create a new one called HOME and assign it to whatever you like. I normally set this to C:\Users\<username>

See also: https://en.wikipedia.org/wiki/Home_directory gives a list of default home directories per OS.

single line tips

  • start . - To start the windows explorer in the current directory
  • start /path/to/dir - To start the windows explorer in the directory of interest.

accessing file locally from browser

sample path

    file:///H:/path/to/file.html
    

send output to file

    script.cmd 1> stdout.txt 2> stderr.txt
    

Ref:- https://stackoverflow.com/questions/503846/how-do-i-echo-and-send-console-output-to-a-file-in-a-bat-script

favorite command prompt configuration

  • properties -> Options -> Buffer Size = 999

Maximum allowed is 999

  • properties -> Layout -> Height = 9999

Maximum allowed is 9999

formatted date and time

Get the date and time information in YYYYMMDD_HHMMSS format

    >echo %date:~6,4%%date:~3,2%%date:~0,2%_%time:~0,2%%time:~3,2%%time:~6,2%
    

Sample output

    20180205_154243
    

reboot on remote desktop

  • Step 1: win+d - minimizes all windows
  • Step 2: Alt-F4 -> Restart

Ref:- https://tinkertry.com/how-to-shutdown-or-restart-windows-over-rdp

executable names

  • mstsc.exe - Remote Desktop Connection

extract a page from PDF

Option 1: Use pdftk

Option 2: Use chrom and print those specific page(s) to pdf. Chrome has print to pdf by default.

    open the pdf in chrome
    click on print icon
    Destination = "Save as PDF"
    Pages: e.g. 1-5, 8, 11-13
    Save
    

Remote desktop

ctrl+alt+del

Method 1:

Use ctrl+alt+end

Method 2:

  • Launch the On-Screen Keyboard by running 'osk.exe'
  • Press Control, Alt on the physical keyboard. Then click the delete key in the On-Screen keyboard.

virtual desktops

reorder virtual desktops

Say you have 6 desktops and want to switch 2 and 4.

  1. Create a 7th desktop, move the contents of the 4th into the 7th, one by one, manually, by hand.
  2. Move the contents of the 2nd into the 4th.
  3. Move the contents of the 7th into the 2nd.
  4. Remove the 7th desktop.

Ref:- https://superuser.com/a/1340589/679081

Tips

Print %path% one directory per line

    echo %path:;=&echo.%
    

will print all directories in the PATH variable but one on each line. Compare this with

    echo %path%
    

which prints all the directories in a single line separated by ';'

tags | pretty print PATH environment variable

How do I

Find out if a dll is 32 bit or 64 bit

Use the file command that comes with "git for windows".

    $ file /path/to/foo.dll
    

It will show PE32 for 32-bit, PE32+ for 64-bit.

Add a directory to windows path

<WIN> + search for "env" -> Edit environment variables for your account

Set the PATH to something like

    C:\path\to\dir;%PATH%
    

tags | set windows path

Map network drive

To map

    net use x: \\computer_name\share_name [/user:domain\username password] [/p:yes]
    

[] indicates that it is optional.

"/user:domain\username password" - needed only if you want to pass in a different set of credentials.

"/p:yes" - to make the mount permanent across reboots. Use /PERSISTENT if /p does not work.

To delete

    net use x: /delete
    

export list of installed software

update | This did not work on "Windows 10 Enterprise" as a normal user. I tried it on 2021-11-09.

In the windows command prompt (start -> run -> cmd), run wmic.

In wmic prompt, enter

    /output:<output_file_path> product get name,version
    

For example,

    /output:C:\users\raju\x\install_list.txt product get name,version
    

Enter exit to exit out of the wmic prompt.

Ref:- https://kencenerelli.wordpress.com/2017/11/25/list-installed-programs-on-windows-10/

list odbc drivers installed

start -> search for odbc -> click on 'Microsoft ODBC Administrator' -> Drivers tab

will show all the ODBC drivers installed on your system.

check if a machine is physical or virtual

Try one of the following commands in the CMD window

    systeminfo | find "System Model"
    
    systeminfo | find "System Manufacturer"
    

For virtual machines, the output will be something like

    System Model:              VMware Virtual Platform
    
    System Manufacturer:       VMware, Inc.
    

view wireless password

In Windows 10

    Control Panel -> Network and Internet -> Network and Sharing Center
    -> View your active networks -> Connections -> Wi-Fi (SSID)
    -> General -> Wireless Properties
    -> Security -> Show characters -> check
    

cmd redirect output to file

To overwrite

    cmd_foo > output.txt
    

To append

    cmd_foo >> output_history.txt
    

Command line

Copy one file to another

"xcopy /y" is like "cp -f"

    set PROJECT_ROOT=C:\path\to\project
    xcopy /y %PROJECT_ROOT%\src\file.txt %PROJECT_ROOT%\dest\file.txt
    

Ref:- https://stackoverflow.com/questions/986447/batch-file-to-copy-files-from-one-folder-to-another-folder

batch script

setting variables

    set a=100
    echo %a%
    

print working directory

    echo Current working directory is %cd%
    

check if variable is defined

    $ cat cmd_arg.cmd
    @echo off
    set foo=%1
    if "%foo%"=="" (
      set foo=kama
    )
    
    set foo
    
    C:\Users\raju\x>cmd_arg.cmd
    foo=kama
    
    C:\Users\raju\x>cmd_arg.cmd raju
    foo=raju
    

exit out of the script

    $ cat exit_out.cmd
    @echo off
    set foo=%1
    if "%foo%"=="" (
      echo "foo is not defined. Exiting"
      exit /b
    )
    
    set foo
    
    C:\Users\monjuu-g\raju\x>exit_out.cmd
    "foo is not defined. Exiting"
    
    C:\Users\monjuu-g\raju\x>exit_out.cmd kama
    foo=kama
    

Office communicator

my favorite configuration

  • Disable emoticons

Tools -> Options -> General -> Show emoticons in instant messages -> uncheck

Note:- This will disable emoticons just on your side. Other people will still see the emoticons unless they have disabled as above.

Shortcuts

action shortcut
Bold ctrl+b
Italicized ctrl+i
Underline ctrl+u
Strikethrough ctrl+t
Increase font size ctrl+]
Decrease font size ctrl+[
Change font size ctrl+shift+f

IE

pop-up blocker

Tools (the last icon on the right) -> "Internet Options -> Privacy tab -> check/uncheck "Turn on Pop-up Blocker" -> Apply -> OK

Windows 2012

change environment variables

    Start menu -> Control Panel -> System -> Advanced system settings -> Environment Variables
    

bookmarks

Do not

Do not install