- Command line parameters or configuration file?
- 4 Answers 4
- Command line arguments:
- Configuration files:
- Как зайти в msconfig на Windows 7/8/10
- Что такое Msconfig
- Запускаем msconfig на Виндовс
- Способ 1. Используем строку поиска (Windows 7,8)
- Способ 2. Используем для входа командную строку (Windows 7,8)
- Способ 3. Как зайти в msconfig с помощью команды «Выполнить» (Windows 7,8,10)
- Способ 4. Отыскиваем программу на жёстком диске (Windows 7)
- Способ 5. Запускаем конфигурацию системы (Windows 10)
- Как работать с утилитой msconfig
- Заключение
- Location of OpenSSH configuration file on Windows
- 3 Answers 3
- Little example
- Other Command
- Windows command config file
- Syntax
- Parameters
- Remarks
Command line parameters or configuration file?
I’m developing a tool that will perform several types of analysis, and each analysis can have different levels of thoroughness. This app will have a fair amount of options to be given before it starts. I started implementing this using a configuration file, since the number of types of analysis specified were little. As the number of options implemented grew, I created more configuration files. Then, I started mixing some command line parameters since some of the options could only be flags. Now, I’ve mixed a bunch of command line parameters with configuration files and feel I need refactoring.
My question is, When and why would you use command line parameters instead of configuration files and vice versa?
Is it perhaps related to the language you use, personal preference, etc.?
EDIT: I’m developing a java app that will work in Windows and Mac. I don’t have a GUI for now.
4 Answers 4
Command line parameters are useful for quickly overriding some parameter setting from the configuration file. As well, command line parameters are useful if there are not so many parameters. For your case, I’d suggest that you export parameter presets to command line.
Command line arguments:
Pros:
- concise — no extra config files to maintain by itself
- great interaction with bash scripts — e.g. variable substitution, variable reference, bash math, etc.
Cons:
- it could get very long as the options become more complex
- formatting is inflexible — besides some command line utilities that help you parse the high level switches and such, anything more complex (e.g. nested structured information) requires custom syntax such as using Regex, and the structure could be quite rigid — while JSON or YAML would be hard to specify at the command line level
Configuration files:
Pros:
- it can be very large, as large as you need it to be
- formatting is more flexible — you can use JSON, YAML, INI, or any other structural format to represent the information in a more human consumable way
Cons:
- inflexible to interact with bash variable substitutions and references (as well as bash math) — you have to probably define your own substitution rules if you want the config file to be «generic» and reusable, while this is the biggest advantage of using command line arguments — variable math would be difficult in config files (if not impossible) — you have to define your own «operator» in the config files, or you have to rely on another bash script to carry out the variable math, and perform your custom variable substitution so the «generic» config file could become «concretely usable».
- for all that it takes to have a generic config file (with custom defined variable substitution rules) ready, a bash script is still needed to carry out the actual substitution, and you still have to code your command line to accept all the variable substitutions, so either you have config files with no variable substitution, which means you «hard code» and repeat the config file for different scenarios, or the substitution logic with custom variable substitution rules make your in-app config file logic much more complex.
In my use case, I value being able to do variable substitution / reference (as well as bash math) in the bash scripts more important, since I’m using the same binary to start many server nodes with different responsibilities in a server backend cluster, and I kind of use the bash scripts as sort of a container or actually a config file to start the many different nodes with differing command line arguments.
Как зайти в msconfig на Windows 7/8/10
Автор: admin · Опубликовано Июль 10, 2016 · Обновлено Июль 16, 2016
Наверное, многие из пользователей не раз сталкивались с упоминанием утилиты msconfig, разработанной для решения различных проблем ОС Windows 7/8/10. Многие слышали о ней, хотели бы узнать поближе, но не знают, как зайти в msconfig в Windows и начать с ним работать. В данном материале я попытаюсь исправить этот недостаток и расскажу, что это такое msconfig, опишу его функционал и особенности, а также поясню, как запустить утилиту в ОС Windows от 7.
Что такое Msconfig
MSCONFIG (аббревиатура от «Microsoft System Configuration Utility») – это специальная утилита, предназначенная для устранения неисправностей на вашем компьютере. По мнению разработчиков, она должна обеспечивать более быструю и надёжную загрузку файлов операционной системы, препятствовать различным сбоям и программным конфликтам.
Запущенная утилита msconfig в Windows 7
Функционал утилиты msconfig позволяет эффективно выявлять причины дисфункций в работе вашего ПК, более точно идентифицировать проблемные драйвера, файлы и другие системные компоненты. Она позволяет активировать и деактивировать запуск автоматически загружаемых программ и служб, запускать безопасный режим, проводить подробный мониторинг работы запускаемых файлов и так далее — в общем, осуществлять общую конфигурацию работы вашего ПК.
Запускаем msconfig на Виндовс
Для того чтобы зайти в утилиту msconfig нужно выполнить следующие шаги.
Способ 1. Используем строку поиска (Windows 7,8)
- Нажимаем кнопку «Пуск», вводим в строке поиска msconfig и нажимаем Enter.
- В интерфейсе Metro на Windows 8 и 8,1 кнопка поиска находится внизу справа, кликаем на неё и пишем в строке поиска msconfig, а затем нажимаем на клавишу Enter.
Способ 2. Используем для входа командную строку (Windows 7,8)
- Жмём на Пуск, далее выбираем «Все программы», затем «Стандартные» — «Командная строка».
- В появившейся консоли вводим msconfig и нажимаем Enter.
- В Windows 8 жмём правой клавишей мыши на пустом месте рабочего стола, в появившейся панели кликаем на значок «все приложения», и находим там командную строку.
- Запускаем её, а в ней пишем msconfig, и подтверждаете, нажав Enter.
Способ 3. Как зайти в msconfig с помощью команды «Выполнить» (Windows 7,8,10)
Для того чтобы войти в msconfig, нажимаем сочетание клавиш Win+R, в появившейся окне набираем msconfig и жмём Enter.
Запускаем приложение через Пуск
Способ 4. Отыскиваем программу на жёстком диске (Windows 7)
Идём по пути Windows\System32\ и отыскиваем там файл msconfig.exe. Запускаем его.
Способ 5. Запускаем конфигурацию системы (Windows 10)
На панели задач находим команду «Конфигурация системы» и выбираем классическое приложение «Конфигурация системы».
Как работать с утилитой msconfig
После запуска утилиты msconfig вы попадёте в меню, которое имеет пять основных вкладок.
Во вкладке «Общие» вы можете выбрать один из видов запусков операционный системы. Представлены «обычный запуск», при котором загружаются все необходимые драйвера и службы, «диагностический» — загружает только базовый набор служб и драйверов, и «выборочный», где вы можете выбрать, что именно необходимо загрузить.
Интерфейс msconfig после входа
В «Загрузка» вы можете сделать выбор ОС, загружаемой по умолчанию, проставить время для выбора нужной системы при запуске компьютера, Также вы можете задействовать мониторинг журнала загрузки, выбрать загрузку без GUI (анимации при загрузке), выводить информацию о загружаемых элементах ОС, а также поработать с различными вариантами безопасного режима. При этом нажав на кнопку «Дополнительные параметры» вы зайдёте в дополнительное меню, где сможете проставить число используемых системой процессоров, максимум памяти и другие параметры.
«Службы» позволяют включать и отключать различные службы, задействованные в работе операционной системы. При этом, поставив галочку внизу слева, вы можете отключить отображение служб от Microsoft и познакомиться со списком сторонних служб, задействованных на вашем компьютере.
В «Автозагрузка» можно выбрать список автоматически загружаемых программ, а «Сервис» позволит использовать функционал программ для администрирования вашего ПК. Для примера, выберите любую из списка программ и нажмите «Запуск».
Как выглядит работа с msconfig, вы можете посмотреть на видео:
Заключение
Функционал утилиты msconfig позволяет достаточно эффективно проводить ремонт и отладку нашей операционной системы Windows 7/8/10. Вы можете сами устанавливать параметры автозагрузки, тестировать работу системных служб и приложений, проводить полное администрирование вашей машины. При этом приложение msconfig легко запустить с помощью различных способов, что делает его удобным и полезным инструментом в арсенале опытного пользователя. Если вы не были знакомы с тем, как зайти в msconfig и как его использовать, то, быть может, пришло время для более детального знакомства.
Location of OpenSSH configuration file on Windows
How do I set the host name and port in a config file for Windows, using OpenSSH through PowerShell?
As on Unix/Linux:
Edit or create the file now by typing:
In here, you can set host-specific configuration options. To specify your new port, use a format like this:
Host remote_alias HostName remote_host Port port_num
This will allow you to log in without specifying the specific port number on the command line.
3 Answers 3
In Windows 10 with PowerShell, the configuration files are not created, so we have to create them ourselves.
This answer was done with: Windows 10 PRO 20H2 (Build 19042.804)
And with the last OpenSSH-Portable (v8.1.0.0p1-Beta) from the official GitHub here
NOTE 1 : Here I show how to configure only the configuration file «config» in the folder .ssh, which should be in the user folder $HOME\.ssh , because it is what is required, normally, it seems to me that the other files are created automatically when one Install Open-SSH server. if this is not the case, simply adapt the command lines
NOTE 2 : Have Git for Windows and OpenSSH-portable can cause problems for the configuration of the agent, so you should know that it is the SSH-Agent uses by the Windows service
You can find out which ssh-agent is used by the Windows service with this command :
If the Get-WmiObject command no longer works you can use the Get-CimInstance command which should be its definitive successor for new versions of PowerShell
After that, you can configure the SSH configuration file as you want with the same syntax as on Linux
Little example
Now you can test your config like that :
If ssh doesn’t work, this is because you don’t have the OpenSSH folder in your environment variables, you can add it to your system environment variable like that in Powershell if you install
OpenSSH Binary in C:\Program Files
and the folder name is OpenSSH-Win64
Other Command
The OpenSSH configuration and key files (including the config , known_hosts , authorized_keys , id_rsa , etc.), which on *nix go to
/.ssh , on Win32-OpenSSH they go to %USERPROFILE%\.ssh .
That typically is:
After OpenSSH installs, perform some additional configuration steps.
Ensure that the OpenSSH folder is included on the system path environment variable:
C:\Windows\System32\OpenSSH\ if installed as the Windows optional feature C:\Program Files\OpenSSH\ if installed via the OpenSSH download Set the two services to start automatically:
If you installed OpenSSH with the optional feature, then Windows creates a new firewall rule to allow inbound access of SSH over port 22. If you installed OpenSSH from the download, then create the firewall rule with this command:
Start the sshd service to generate the SSH keys:
The SSH keys and configuration file reside in C:\ProgramData\ssh , which is a hidden folder. The default shell used by SSH is the Windows command shell. This needs to change to PowerShell:
Now, when you connect to the system over SSH, PowerShell Core will start and will be the default shell. You can also make the default shell Windows PowerShell if desired.
There’s a bug in OpenSSH on Windows. It doesn’t work with paths with a space, such as the path to the PowerShell Core executable! The workaround is to create a symbolic link that creates a path that OpenSSH can use:
In the sshd_config file, un-comment the following lines:
Add this line before other subsystem lines:
This tells OpenSSH to run PowerShell Core.
Comment out the line:
After saving the changes to the sshd_config file, restart the services:
You need to restart the sshd service after any change to the config file.
Windows command config file
Starts a new instance of the command interpreter, Cmd.exe. If used without parameters, cmd displays the version and copyright information of the operating system.
Syntax
Parameters
Parameter | Description |
---|---|
/c | Carries out the command specified by string and then stops. |
/k | Carries out the command specified by string and continues. |
/s | Modifies the treatment of string after /c or /k. |
/q | Turns the echo off. |
/d | Disables execution of AutoRun commands. |
/a | Formats internal command output to a pipe or a file as American National Standards Institute (ANSI). |
/u | Formats internal command output to a pipe or a file as Unicode. |
/t: < | > | Sets the background (b) and foreground (f) colors. |
/e:on | Enables command extensions. |
/e:off | Disables commands extensions. |
/f:on | Enables file and directory name completion. |
/f:off | Disables file and directory name completion. |
/v:on | Enables delayed environment variable expansion. |
/v:off | Disables delayed environment variable expansion. |
Specifies the command you want to carry out. | |
/? | Displays help at the command prompt. |
The following table lists valid hexadecimal digits that you can use as the values for and :
Value | Color |
---|---|
0 | Black |
1 | Blue |
2 | Green |
3 | Aqua |
4 | Red |
5 | Purple |
6 | Yellow |
7 | White |
8 | Gray |
9 | Light blue |
a | Light green |
b | Light aqua |
c | Light red |
d | Light purple |
e | Light yellow |
f | Bright white |
Remarks
To use multiple commands for , separate them by the command separator && and enclose them in quotation marks. For example:
If you specify /c or /k, cmd processes, the remainder of string, and the quotation marks are preserved only if all of the following conditions are met:
You don’t also use /s.
You use exactly one set of quotation marks.
You don’t use any special characters within the quotation marks (for example: & ( ) @ ^ | ).
You use one or more white-space characters within the quotation marks.
The string within quotation marks is the name of an executable file.
If the previous conditions aren’t met, string is processed by examining the first character to verify whether it is an opening quotation mark. If the first character is an opening quotation mark, it is stripped along with the closing quotation mark. Any text following the closing quotation marks is preserved.
If you don’t specify /d in string, Cmd.exe looks for the following registry subkeys:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun\REG_SZ
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun\REG_EXPAND_SZ
If one or both registry subkeys are present, they’re executed before all other variables.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
You can disable command extensions for a particular process by using /e:off. You can enable or disable extensions for all cmd command-line options on a computer or user session by setting the following REG_DWORD values:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions\REG_DWORD
Set the REG_DWORD value to either 0Г—1 (enabled) or 0Г—0 (disabled) in the registry by using Regedit.exe. User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
When you enable command extensions, the following commands are affected:
assoc
call
chdir (cd)
color
del (erase)
endlocal
for
ftype
goto
if
mkdir (md)
popd
prompt
pushd
set
setlocal
shift
start (also includes changes to external command processes)
If you enable delayed environment variable expansion, you can use the exclamation point character to substitute the value of an environment variable at run time.
File and directory name completion is not enabled by default. You can enable or disable file name completion for a particular process of the cmd command with /f:<on | off>. You can enable or disable file and directory name completion for all processes of the cmd command on a computer or for a user logon session by setting the following REG_DWORD values:
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar\REG_DWORD
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar\REG_DWORD
To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of a control character for a particular function (for example, 0Г—9 is TAB and 0Г—08 is BACKSPACE). User-specified settings take precedence over computer settings, and command-line options take precedence over registry settings.
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.
If you enable file and directory name completion by using /f:on, use CTRL+D for directory name completion and CTRL+F for file name completion. To disable a particular completion character in the registry, use the value for white space [0Г—20] because it is not a valid control character.
Pressing CTRL+D or CTRL+F, processes the file and directory name completion. These key combination functions append a wildcard character to string (if one is not present), builds a list of paths that match, and then displays the first matching path.
If none of the paths match, the file and directory name completion function beeps and does not change the display. To move through the list of matching paths, press CTRL+D or CTRL+F repeatedly. To move through the list backwards, press the SHIFT key and CTRL+D or CTRL+F simultaneously. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. The only difference between the key combinations CTRL+D and CTRL+F is that CTRL+D only matches directory names and CTRL+F matches both file and directory names. If you use file and directory name completion on any of the built-in directory commands (that is, CD, MD, or RD), directory completion is assumed.
File and directory name completion correctly processes file names that contain white space or special characters if you place quotation marks around the matching path.
You must use quotation marks around the following special characters: & [ ] | < >^ = ; ! ‘ + , `
If the information that you supply contains spaces, you must use quotation marks around the text (for example, «Computer Name»).
If you process file and directory name completion from within string, any part of the path to the right of the cursor is discarded (at the point in string where the completion was processed).