All show config windows

sc.exe config

Modifies the value of a service’s entries in the registry and in the Service Control Manager database.

Syntax

Parameters

Parameter Description
Specifies the name of the remote server on which the service is located. The name must use the Universal Naming Convention (UNC) format (for example, \myserver). To run SC.exe locally, don’t use this parameter.
Specifies the service name returned by the getkeyname operation.
type= > Specifies the service type. The options include:
  • own — Specifies a service that runs in its own process. It doesn’t share an executable file with other services. This is the default value.
  • share — Specifies a service that runs as a shared process. It shares an executable file with other services.
  • kernel — Specifies a driver.
  • filesys — Specifies a file system driver.
  • rec — Specifies a file system-recognized driver that identifies file systems used on the computer.
  • adapt — Specifies an adapter driver that identifies hardware devices such as keyboards, mice, and disk drives.
  • interact — Specifies a service that can interact with the desktop, receiving input from users. Interactive services must be run under the LocalSystem account. This type must be used in conjunction with type= own or type= shared (for example, type= interacttype= own). Using type= interact by itself will generate an error.
start= Specifies the start type for the service. The options include:
  • boot — Specifies a device driver that is loaded by the boot loader.
  • system — Specifies a device driver that is started during kernel initialization.
  • auto — Specifies a service that automatically starts each time the computer is restarted and runs even if no one logs on to the computer.
  • demand — Specifies a service that must be started manually. This is the default value if start= is not specified.
  • disabled — Specifies a service that cannot be started. To start a disabled service, change the start type to some other value.
  • delayed-auto — Specifies a service that starts automatically a short time after other auto services are started.
error= Specifies the severity of the error if the service fails to start when the computer is started. The options include:
  • normal — Specifies that the error is logged and a message box is displayed, informing the user that a service has failed to start. Startup will continue. This is the default setting.
  • severe — Specifies that the error is logged (if possible). The computer attempts to restart with the last-known good configuration. This could result in the computer being able to restart, but the service may still be unable to run.
  • critical — Specifies that the error is logged (if possible). The computer attempts to restart with the last-known good configuration. If the last-known good configuration fails, startup also fails, and the boot process halts with a Stop error.
  • ignore — Specifies that the error is logged and startup continues. No notification is given to the user beyond recording the error in the Event Log.
binpath= Specifies a path to the service binary file. There is no default for binpath=, and this string must be supplied.
group= Specifies the name of the group of which this service is a member. The list of groups is stored in the registry, in the HKLM\System\CurrentControlSet\Control\ServiceGroupOrder subkey. The default value is null.
tag= Specifies whether or not to obtain a TagID from the CreateService call. Tags are used only for boot-start and system-start drivers.
depend= Specifies the names of services or groups that must start before this service. The names are separated by forward slashes (/).
obj= <| > Specifies a name of an account in which a service will run, or specifies a name of the Windows driver object in which the driver will run. The default setting is LocalSystem.
displayname= Specifies a descriptive name for identifying the service in user interface programs. For example, the subkey name of one particular service is wuauserv, which has a more friendly display name of Automatic Updates.
password=

Specifies a password. This is required if an account other than the LocalSystem account is used. /? Displays help at the command prompt.

Remarks

Each command-line option (parameter) must include the equal sign as part of the option name.

A space is required between an option and its value (for example, type= own. If the space is omitted, the operation fails.

Examples

To specify a binary path for the NewService service, type:

ipconfig

Displays all current TCP/IP network configuration values and refreshes Dynamic Host Configuration Protocol (DHCP) and Domain Name System (DNS) settings. Used without parameters, ipconfig displays Internet Protocol version 4 (IPv4) and IPv6 addresses, subnet mask, and default gateway for all adapters.

Syntax

Parameters

Parameter Description
/all Displays the full TCP/IP configuration for all adapters. Adapters can represent physical interfaces, such as installed network adapters, or logical interfaces, such as dial-up connections.
/displaydns Displays the contents of the DNS client resolver cache, which includes both entries preloaded from the local Hosts file and any recently obtained resource records for name queries resolved by the computer. The DNS Client service uses this information to resolve frequently queried names quickly, before querying its configured DNS servers.
/flushdns Flushes and resets the contents of the DNS client resolver cache. During DNS troubleshooting, you can use this procedure to discard negative cache entries from the cache, as well as any other entries that have been added dynamically.
/registerdns Initiates manual dynamic registration for the DNS names and IP addresses that are configured at a computer. You can use this parameter to troubleshoot a failed DNS name registration or resolve a dynamic update problem between a client and the DNS server without rebooting the client computer. The DNS settings in the advanced properties of the TCP/IP protocol determine which names are registered in DNS.
/release [] Sends a DHCPRELEASE message to the DHCP server to release the current DHCP configuration and discard the IP address configuration for either all adapters (if an adapter is not specified) or for a specific adapter if the adapter parameter is included. This parameter disables TCP/IP for adapters configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/release6 [] Sends a DHCPRELEASE message to the DHCPv6 server to release the current DHCP configuration and discard the IPv6 address configuration for either all adapters (if an adapter is not specified) or for a specific adapter if the adapter parameter is included. This parameter disables TCP/IP for adapters configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/renew [] Renews DHCP configuration for all adapters (if an adapter is not specified) or for a specific adapter if the adapter parameter is included. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/renew6 [] Renews DHCPv6 configuration for all adapters (if an adapter is not specified) or for a specific adapter if the adapter parameter is included. This parameter is available only on computers with adapters that are configured to obtain an IPv6 address automatically. To specify an adapter name, type the adapter name that appears when you use ipconfig without parameters.
/setclassid [ ] Configures the DHCP class ID for a specified adapter. To set the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically. If a DHCP class ID is not specified, the current class ID is removed.
/showclassid Displays the DHCP class ID for a specified adapter. To see the DHCP class ID for all adapters, use the asterisk (*) wildcard character in place of adapter. This parameter is available only on computers with adapters that are configured to obtain an IP address automatically.
/? Displays Help at the command prompt.

Remarks

This command is most useful on computers that are configured to obtain an IP address automatically. This enables users to determine which TCP/IP configuration values have been configured by DHCP, Automatic Private IP Addressing (APIPA), or an alternate configuration.

If the name you supply for adapter contains any spaces, use quotation marks around the adapter name (for example, «adapter name»).

For adapter names, ipconfig supports the use of the asterisk (*) wildcard character to specify either adapters with names that begin with a specified string or adapters with names that contain a specified string. For example, Local* matches all adapters that start with the string Local and *Con* matches all adapters that contain the string Con.

Examples

To display the basic TCP/IP configuration for all adapters, type:

To display the full TCP/IP configuration for all adapters, type:

To renew a DHCP-assigned IP address configuration for only the Local Area Connection adapter, type:

To flush the DNS resolver cache when troubleshooting DNS name resolution problems, type:

To display the DHCP class ID for all adapters with names that start with Local, type:

To set the DHCP class ID for the Local Area Connection adapter to TEST, type:

WSL commands and launch configurations

Ways to run WSL

There are several ways to run a Linux distribution with WSL once it’s installed.

  1. Open your Linux distribution by visiting the Windows Start menu and typing the name of your installed distributions. For example: «Ubuntu».
  2. From Windows Command Prompt or PowerShell, enter the name of your installed distribution. For example: ubuntu
  3. From Windows Command Prompt or PowerShell, to open your default Linux distribution inside your current command line, enter: wsl.exe .
  4. From Windows Command Prompt or PowerShell, to open your default Linux distribution inside your current command line, enter: wsl [command] .

Which method you should use depends on what you’re doing. If you’ve opened a WSL command line within a Windows Prompt or PowerShell window and want to exit, enter the command: exit .

Launch WSL by distribution

Running a distribution using it’s distro-specific application launches that distribution in it’s own console window.

It is the same as clicking «Launch» in the Microsoft store.

You can also run the distribution from the command line by running [distribution].exe .

The disadvantage of running a distribution from the command line in this way is that it will automatically change your working directory from the current directory to the distribution’s home directory.

Example: (using PowerShell)

wsl and wsl [command]

The best way to run WSL from the command line is using wsl.exe .

Example: (using PowerShell)

Not only does wsl keep the current working directory in place, it lets you run a single command along side Windows commands.

Example: (using PowerShell)

Example: (using PowerShell)

Managing multiple Linux Distributions

In Windows 10 Version 1903 and later, you can use wsl.exe to manage your distributions in the Windows Subsystem for Linux (WSL), including listing available distributions, setting a default distribution, and uninstalling distributions.

Each Linux distribution independently manages its own configurations. To see distribution-specific commands, run [distro.exe] /? . For example ubuntu /? .

List distributions

wsl -l , wsl —list
Lists available Linux distributions available to WSL. If a distribution is listed, it’s installed and ready to use.

wsl —list —all Lists all distributions, including ones that aren’t currently usable. They may be in the process of installing, uninstalling, or are in a broken state.

wsl —list —running Lists all distributions that are currently running.

Set a default distribution

The default WSL distribution is the one that runs when you run wsl on a command line.

wsl -s , wsl —setdefault

Sets the default distribution to .

Example: (using PowerShell)
wsl -s Ubuntu would set my default distribution to Ubuntu. Now when I run wsl npm init it will run in Ubuntu. If I run wsl it will open an Ubuntu session.

Unregister and reinstall a distribution

While Linux distributions can be installed through the Microsoft store, they can’t be uninstalled through the store. WSL Config allows distributions to be unregistered/uninstalled.

Unregistering also allows distributions to be reinstalled.

Caution: Once unregistered, all data, settings, and software associated with that distribution will be permanently lost. Reinstalling from the store will install a clean copy of the distribution.

wsl —unregister
Unregisters the distribution from WSL so it can be reinstalled or cleaned up.

For example: wsl —unregister Ubuntu would remove Ubuntu from the distributions available in WSL. When I run wsl —list it will not be listed.

To reinstall, find the distribution in the Microsoft store and select «Launch».

Run as a specific user

wsl -u , wsl —user

Run WSL as the specified user. Please note that user must exist inside of the WSL distribution.

Change the default user for a distribution

Change the default user that for your distribution log-in. The user has to already exist inside the distribution in order to become the default user.

For example: ubuntu config —default-user johndoe would change the default user for the Ubuntu distribution to the «johndoe» user.

If you are having trouble figuring out the name of your distribution, see List distributions for the command to list the official name of the installed distributions.

Run a specific distribution

wsl -d , wsl —distribution

Run a specified distribution of WSL, can be used to send commands to a specific distribution without having to change your default.

Managing multiple Linux Distributions in earlier Windows versions

In Windows 10 prior to version 1903, the WSL Config ( wslconfig.exe ) command-line tool should be used to manage Linux distributions running on the Windows Subsystem for Linux (WSL). It lets you list available distributions, set a default distribution, and uninstall distributions.

While WSL Config is helpful for settings that span or coordinate distributions, each Linux distribution independently manages its own configurations. To see distribution-specific commands, run [distro.exe] /? . For example ubuntu /? .

To see all available options for wslconfig, run: wslconfig /?

To list distributions, use:

wslconfig /list
Lists available Linux distributions available to WSL. If a distribution is listed, it’s installed and ready to use.

wslconfig /list /all
Lists all distributions, including ones that aren’t currently usable. They may be in the process of installing, uninstalling, or are in a broken state.

To set a default distribution that runs when you run wsl on a command line:

wslconfig /setdefault Sets the default distribution to .

Example: (using PowerShell)
wslconfig /setdefault Ubuntu would set my default distribution to Ubuntu. Now when I run wsl npm init it will run in Ubuntu. If I run wsl it will open an Ubuntu session.

To unregister and reinstall a distribution:

wslconfig /unregister
Unregisters the distribution from WSL so it can be reinstalled or cleaned up.

For example: wslconfig /unregister Ubuntu would remove Ubuntu from the distributions available in WSL. When I run wslconfig /list it will not be listed.

To reinstall, find the distribution in the Microsoft store and select «Launch».

Configure per distro launch settings with wslconf

Available in Windows Build 17093 and later

Automatically configure functionality in WSL that will be applied every time you launch the subsystem using wsl.conf . This includes automount options and network configuration.

wsl.conf is located in each Linux distribution in /etc/wsl.conf . If the file is not there, you can create it yourself. WSL will detect the existence of the file and will read its contents. If the file is missing or malformed (that is, improper markup formatting), WSL will continue to launch as normal.

Here is a sample wsl.conf file you could add into your distributions:

When launching multiple Linux shells for the same distribution, you must wait until the Linux subsystem stops running, this can take approximately 8 seconds after closing the last instance of the distribution shell. If you launch a distribution (ie. Ubuntu), modify the wsl.conf file, close the distribution, and then re-launch it. You might assume that your changes to the wsl.conf file have immediately gone into effect. This is not currently the case as the subsystem could still be running. You must wait

8 seconds for the subsystem to stop before relaunching in order to give enough time for your changes to be picked up. You can check to see whether your Linux distribution (shell) is still running after closing it by using PowerShell with the command: wsl —list —running . If no distributions are running, you will receive the response: «There are no running distributions.» You can now restart the distribution to see your wsl.conf updates applied.

Configuration Options

In keeping with .ini conventions, keys are declared under a section.

WSL supports four sections: automount , network , interop , and user .

automount

key value default notes
enabled boolean true true causes fixed drives (i.e C:/ or D:/ ) to be automatically mounted with DrvFs under /mnt . false means drives won’t be mounted automatically, but you could still mount them manually or via fstab .
mountFsTab boolean true true sets /etc/fstab to be processed on WSL start. /etc/fstab is a file where you can declare other filesystems, like an SMB share. Thus, you can mount these filesystems automatically in WSL on start up.
root String /mnt/ Sets the directory where fixed drives will be automatically mounted. For example, if you have a directory in WSL at /windir/ and you specify that as the root, you would expect to see your fixed drives mounted at /windir/c
options comma-separated list of values empty string This value is appended to the default DrvFs mount options string. Only DrvFs-specific options can be specified. Options that the mount binary would normally parse into a flag are not supported. If you want to explicitly specify those options, you must include every drive for which you want to do so in /etc/fstab.

By default, WSL sets the uid and gid to the value of the default user (in Ubuntu distro, the default user is created with uid=1000,gid=1000). If the user specifies a gid or uid option explicitly via this key, the associated value will be overwritten. Otherwise, the default value will always be appended.

Note: These options are applied as the mount options for all automatically mounted drives. To change the options for a specific drive only, use /etc/fstab instead.

Mount options

Setting different mount options for Windows drives (DrvFs) can control how file permissions are calculated for Windows files. The following options are available:

Key Description Default
uid The User ID used for the owner of all files The default User ID of your WSL distro (On first installation this defaults to 1000)
gid The Group ID used for the owner of all files The default group ID of your WSL distro (On first installation this defaults to 1000)
umask An octal mask of permissions to exclude for all files and directories 000
fmask An octal mask of permissions to exclude for all files 000
dmask An octal mask of permissions to exclude for all directories 000
metadata Whether metadata is added to Windows files to support Linux system permissions disabled
case Determines directories treated as case sensitive and whether new directories created with WSL will have the flag set. See Per-directory case sensitivity and WSL for a detailed explanation of the options. dir

Note: The permission masks are put through a logical OR operation before being applied to files or directories.

network

Section label: [network]

key value default notes
generateHosts boolean true true sets WSL to generate /etc/hosts . The hosts file contains a static map of hostnames corresponding IP address.
generateResolvConf boolean true true set WSL to generate /etc/resolv.conf . The resolv.conf contains a DNS list that are capable of resolving a given hostname to its IP address.

interop

Section label: [interop]

These options are available in Insider Build 17713 and later.

key value default notes
enabled boolean true Setting this key will determine whether WSL will support launching Windows processes.
appendWindowsPath boolean true Setting this key will determine whether WSL will add Windows path elements to the $PATH environment variable.

Section label: [user]

These options are available in Build 18980 and later.

key value default notes
default string The initial username created on first run Setting this key specifies which user to run as when first starting a WSL session.

Configure global options with .wslconfig

Available in Windows Build 19041 and later

You can configure global WSL options by placing a .wslconfig file into the root directory of your users folder: C:\Users\ \.wslconfig . Many of these files are related to WSL 2, please keep in mind you may need to run wsl —shutdown to shut down the WSL 2 VM and then restart your WSL instance for these changes to take affect.

Here is a sample .wslconfig file:

This file can contain the following options:

WSL 2 Settings

Section label: [wsl2]

These settings affect the VM that powers any WSL 2 distribution.

key value default notes
kernel string The Microsoft built kernel provided inbox An absolute Windows path to a custom Linux kernel.
memory size 50% of total memory on Windows or 8GB, whichever is less; on builds before 20175: 80% of your total memory on Windows How much memory to assign to the WSL 2 VM.
processors number The same number of processors on Windows How many processors to assign to the WSL 2 VM.
localhostForwarding boolean true Boolean specifying if ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.
kernelCommandLine string Blank Additional kernel command line arguments.
swap size 25% of memory size on Windows rounded up to the nearest GB How much swap space to add to the WSL 2 VM, 0 for no swap file.
swapFile string %USERPROFILE%\AppData\Local\Temp\swap.vhdx An absolute Windows path to the swap virtual hard disk.
  • Note: This value is true for Windows Build 19041 and may be different in Windows builds in the Insiders program

Entries with the path value must be Windows paths with escaped backslashes, e.g: C:\\Temp\\myCustomKernel

Entries with the size value must be a size followed by a unit, for example 8GB or 512MB .

Читайте также:  Asus t100ta linux mint
Оцените статью