Windows notes

From raju

To take a screen shot of a particular area

Start Menu -> Snipping Tool


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 soflink's name.

Dummy

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.

• 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

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.

 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

• 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.
• 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.
• 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.
• 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 winword
• win+e will launch the file 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

• 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

starting applications

Program name command shortcut tested on

Set environment variables

C:\Windows\System32\rundll32.exe sysdm.cpl,EditEnvironmentVariables


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


Fixed width fonts in outlook

Use consolas or courier

Linux to Windows

Linux Windows notes
cat type
rm del
rm -rf "path" rd /s /q "path" https://stackoverflow.com/questions/97875/rm-rf-equivalent-for-windows

send output to file

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


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


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\sharename [/user username password] [/P:Yes]  [] indicates that it is optional. "/user 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  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  batch script setting variables set a=100 echo %a%  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


IE

pop-up blocker

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