Skip to content

windows configuration

Kittipong R edited this page Mar 19, 2016 · 7 revisions

Annoyance

Remove files and folders

If you are trying to remove files and folders and ran into a problem -- unable to delete. It usually comes down to these potential problems: files are being used by a process, executable are running, or access permissions. Here are some commands to resolve the problems...

Command

## Listing the task
> tasklist
> tasklist | findstr "firefox.exe"
## Powershell
> get-process

## Kill the task -- pid(/PID), name(/IM)
> taskkill /?

## Display a short name (DOS 8.3-format) and long name
## and delete the file/folder
> dir /x
> rmdir /q /s <shortname>

File Permission

When you migrate or copy files from the old hard drive, permissions of old accounts are still around. Here is how over take it.

Command

## Take ownership of the files. Start a Command Prompt (cmd) as an administrator
> takeown /f file
> takeown /f directory /r

## Give yourself full rights on the file:
> cacls file /G username:F
> cacls directory /T /G username:F

Reference

Host file

  • Windows 7 == %systemroot%\system32\drivers\etc\

Network interface preference

If you have two or more network interfaces (eg Wifi and LAN), OS determines which interface to use first by "metric" value. The lower the value, the higher the precedence. You can see these values by running the command:

> netsh int ip show config

The decision is based on IntefaceMetric + GatewayMetric values. So if you want to use Wifi(ex: 20) over LAN(ex: 10), just redefine the GatewayMetric value on those interfaces with route delete/add/change command.

/////////////////////////////////////////////////////////////////
/// Setting
Network and Sharing Center (Control Panel\Network and Internet\Network Connections)
* Right click the interface (ex: LAN) -> Properties
* "Networking" tab -> select "TCP/IPv4" -> "Properties" button
* Click "Advanced" button
* Under "IP Settings" you can add metric to...
** Gateway -- Add/Edit/Remove button
** Interface -- Unclick "Automatic metric" and set the value

/////////////////////////////////////////////////////////////////
/// Command line
$ route print

Interface List
 12...xxxxx ......Intel(R) Centrino(R) Ultimate-N 6300 AGN    /// wifi wanted interface to use
 11...xxxxx ......Intel(R) 82579LM Gigabit Network Connection /// LAN

Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      10.147.16.1     10.147.19.33     10
          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.123     20

/// $ route delete 0.0.0.0 if <interface-id>
/// $ route -p add 0.0.0.0 mask 0.0.0.0 <ip of gateway> metric <delay metric value> if <interface-id>
///
/// Add delay to Wifi
/// $ route delete 0.0.0.0 if 12
/// $ route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1 metric 5 if 12
///
/// Add delay to LAN
$ route delete 0.0.0.0 if 11
$ route -p add 0.0.0.0 mask 0.0.0.0 10.147.16.1 metric 25 if 11

$ route print
...
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      10.147.16.1     10.147.19.33     35
          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.123     20

Clone this wiki locally