How to run a program via the Windows command line

I order tests, coursework, dissertations and any other student work here.

Launching the registry editor via a Bat file Hello. I want to create a Bat file, when launched, the registry editor should be launched.

Running a random .kfn file via bat Hello everyone. There is a folder in which there are about 20 folders and about 200 files in the .kfn format - they are launched from.

Starting a server via bat, surrounded by LAN Good morning gentlemen. A batch file with three D commands is required: cd.

Running a file via bat with a password request Good evening, I wrote a bat code that, when executed, will ask for a password, after which you enter it.

URGENTLY! How to create an .exe via bat Hello. I need to create an .exe file via bat, and all I could think of was to open it.

Launching minecraft 1.12.2 with forge and liteloader TOGETHER via bat Good day! I've been struggling with one problem for several days now - starting minecraft 1.12.2.

Learning the basics of cmd(bat) (FOR BEGINNERS)

Hello pikabushnik. I want you to understand the entire cmd(bat) programming language in a clear language. Well, let's get started?

First, let's look at what cmd(bat) is and what it is used with?

Cmd.exe - command line interpreter

INTERPRETER - One who interprets something. INTERPRET To interpret - to reveal - to reveal the meaning of something by explaining.

We figured this out, now why is it needed? The fact is that some things can be done faster in the command line, and some settings are basically not available in the GUI. You should also keep in mind that there are still utilities that do not have a graphical interface, and sometimes it is unavailable, for example due to a crash.

How to open command prompt (cmd.exe)

press the WIN+R key combination, enter cmd and click Ok; click the “Start” button, enter “command prompt” in the search field and click “Command Prompt” in the search results (you can enter “cmd” and select “cmd” in the results); Click “Start” ⇒ “All Programs” ⇒ “Accessories” ⇒ “Command Prompt”; Open the C:WindowsSystem32 folder in Explorer and run the cmd.exe file.

And so, let's create a text document on the desktop, and then enter into it

To display a message in BAT files, use the echo command: Display messages and switch the display mode of commands on the screen. ECHO [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED] [/LOW | /NORMAL | /HIGH | REALTIME| /ABOVENORMAL | /BELOWNORMAL] [/WAIT] [/B] [command/program] [options]

Command line options:

"title" - the title of the window. Must be in double quotes.

path is the working directory.

B - launches the application without creating a new window and disables processing of the CTRL+C keyboard shortcut. If an application does not handle CTRL+C on its own, the only way to break it is to use CTRL+Break.

I - The new environment will be the original environment passed to cmd.exe, not the current environment.

MIN - Run a command/program in a minimized window.

MAX - Run a command/program in a maximized window.

SEPARATE - Runs a 16-bit Windows program in a separate area of ​​memory.

SHARED - Runs a 16-bit Windows program in a shared memory area.

LOW - Launch the application with IDLE priority (lowest priority).

NORMAL - Launch the application with priority NORMAL.

HIGH - Launch the application with priority HIGH.

REALTIME - Launch the application with priority REALTIME (highest priority).

WAIT - Launch an application and wait for it to complete.

ABOVENORMAL - Launch an application with priority class ABOVENORMAL (higher than standard)

BELOWNORMAL - Launch an application with the priority class BELOWNORMAL (lower than standard)

command/program - If it is an internal cmd.exe command or a batch file, the command processor (cmd.exe) is launched with the /K switch. This means that the window will not be closed after the command completes. If it is not a cmd.exe internal command or a batch file, then it is a program that will be launched in a graphics or text window.

But let's write start https://google.com - with this command, Google will open.

Then write echo I KILLED YOUR WINDOWS

(Mini joke phpkh) - a command that will display text. And finally we write goto A (for the circle to work)

This is what it should look like

Click “File” “Save As” Desktop

Select the file type “All files” and add .bat to the name of your file (in my case, pic)

That's it, now open and check!

Now we can see this picture:

on VK you can ask me to send you a slightly hotter batch file xD

What commands to write

Having figured out how to write launch commands, let's try to figure out what exactly to write. Unfortunately, there are no universal commands that work for absolutely all programs. Therefore, if you want to create shortcuts for quick launch with the specified parameters, you will have to study the program help or contact the developer technical support service.

Very often such information is indicated on the official forums of the application or game. More experienced users or representatives of developers or copyright holders publish detailed information there.

Returning to what was said at the beginning of this article. Specifying parameters became most relevant during the period of mass interest in the game called “Counter-Strike”. Why this interest has become so widespread specifically in “CS” is an ambiguous question; some used it solely for entertainment, others (like, for example, some professional players) in order to individualize the gameplay as much as possible.

For example, here is a list of options for the game "Counter-Strike: Global Offensive" that some users use when starting:

ParameterMeaning
-novidDisabling the intro video
-w 640 -h 480Installing the extension
-consoleConsole activation
-freq 120Setting a screen refresh rate limit
-highRun with higher priority
-condebugSaving logs
-lowRun with reduced priority
-noaafontsDisable antialiasing
-nosyncDeactivating Vsync
-fullscreenRun in full screen mode
-language EnglishSetting the language

Running exe via cmd

CUSTOM COMPUTER ASSEMBLY FOR HOME AND GAMING, 2 YEAR WARRANTY

Professional selection of components, performance test. Go to page »

MODERNIZATION (UPGRADE) OF COMPUTER AND LAPTOP

Modernization (upgrade) of your computer and laptop with the latest technological innovations in computer components. Go to page »

CONFIGURING AND INSTALLING UPDATED VERSIONS OF WINDOWS 7

Setting up a computer, installing and reinstalling the operating system windows 7, XP, Vista Go to page »

COMPUTER REPAIR ON THE DAY OF CALL

Urgent computer repair on the same day, computer repair of any complexity. Go to page »

LAPTOP REPAIR

Repairing laptops of any complexity, setting up and installing programs. Cleaning laptops from dust and stains. Go to page »

INSTALLATION AND CONFIGURATION of Windows 8, specialist visit to your home or office!

New Windows 8 operating system, professional configuration and installation on a computer and laptop. Go to page »

INSTALLING ANTI-VIRUS PROGRAMS Kaspersky, Dr.Web, NOD-32, AVAST

Remove viruses and malware from your computer! Go to page »

How to run a program via the command line

We are used to launching programs and applications by simply double-clicking the left mouse button on a shortcut or executable file. But sometimes you may need to run the program through the command line, for example when performing a system restore.

How to launch a system application via the command line?

Open the command line, which can be launched through the start menu Start - All Programs - Accessories - Command Prompt or using the Run tool by typing open CMD.

Programs are launched from the command line using the START command. An example of starting notepad via the command line: start notepad

After you press Enter, a Notepad window will appear. In the same way, you can launch explorer, control panel, system configuration program (msconfig) and other system utilities and programs.

However, the user will not always be satisfied with only system applications; very often it is necessary to launch a specific program installed on the system.

How to run any application using the command line?

Any application can be launched by specifying the full path to the executable file. However, if you try to explicitly specify the path to the START command, for example, to the Opera Internet browser, then nothing will work: start c:Program Files (x86)Operaopera.exe

Running such a command will result in an error because the start command does not recognize the specified path. The command can recognize the program path only if it does not contain spaces. In this case, this path must be saved before running the application. There is a PATH command for these purposes.

Enter the following command into the command line: path c:Program Files (x86)Opera

This will allow the program to save the path to the specified folder and use it when launching any application that will be located inside this folder. The following command: start opera will allow the user to start the Internet browser. Please note that in this case it is not necessary to specify the file resolution; the command will recognize it automatically. If there are other executable files inside the folder, then they can also be launched in this way.

Use your keyboard to open as administrator faster

As with many operations, you can use keyboard shortcuts to run programs as an administrator faster. To do this, using only your keyboard, press the Windows to open the search bar, after which you can immediately start typing the name of the program you want to open.

Once it's selected, hold Ctrl + Shift and press Enter . left arrow key and then Enter to accept it without touching your mouse.

In some places, you can hold Ctrl + Shift while clicking on a program icon to run it as an administrator. However, this was inconsistent in our testing.

"Registration.exe" so you can run it from any command line in Windows

How can you make an .exe file accessible from anywhere in the Windows Command Prompt window? Is there some registry entry that needs to be entered?

15 answers

you need to make sure that the exe is in a folder that is on your PATH environment variables.

you can do this by installing it to a folder that is already on PATH or by adding your folder to PATH .

you can ask your installer to do this, but you will need to reboot the machine to ensure it will be picked up.

you can add the following key sections:

in this key add a default string value containing the path to the exe file.

you need .exe file path into path environment variable. Go to "My Computer -> Properties -> Advanced -> Environment Variables -> Path" and edit the path by adding .exe's directory to the path.

another solution that I personally prefer uses RapidEE for smoother variable editing.

Instead of placing the executable in a directory along the path, you should create a batch file in the directory along the path that runs the program. This way you don't separate the executable from its supporting files, and you don't add other things in the same directory to the path unintentionally.

such a batch file might look like this:

Windows 10, 8.1, 8

Open the Start menu,

  1. type Edit environment variables
  2. open the option Edit the system environment variables
  3. cry
  4. there you see two boxes, in System Variables box find path variable
  5. click Edit
  6. a window appears, click New
  7. enter directory path .exe or ( directory means exclude filename from path)
  8. Click Ok on all open windows and reboot the system, restart the command line .
  • If you want to be able to run it inside UMK.exe or batch files you need to add it to the .exe directory located in the %path% ( or ) variable
  • If you want to be able to run it in the run dialog (Win+R) or in any application that calls ShellExecute adding the exe to the app path key is sufficient (this is less error prone during installation/uninstallation and also does not clutter the path variable)

It's surprising that there is no easy solution for such a simple task in windows. I created this little cmd script that you can use to define aliases in windows (instructions are in the file header itself):

This is pretty much the same approach used by tools like NPM or ruby ​​gems for registering global commands.

you can also permanently (after reboot) add a variable to the path like this:

Right-click My Computer -> click Properties -> Click Advanced System Settings -> Click Environment Variables

put it in the c:windows directory or add your directory to the "path" in environment-settings (Windows-break - tab advanced)

use a 1 line batch file in your installation:

run the bat file

Now place your .exe in c:windows and you are done.

you can type 'exename' in the command line and run it.

Autoloading of programs does not work when the computer is turned on

There are situations when software autoload when starting Windows 10 does not work. We proceed as follows:

  1. We make sure there is no conflict with the antivirus. To do this, disable the latter. If startup is normal, then do the following: Remove the program from the registry and add it again.
  2. We update or reinstall antivirus software.
  • Let's check what we added to the startup folder. If these are program files and not its shortcut, then there will be no autorun. An exception may be utilities that are presented only as an executable file.
  • Let's see if we have placed an application shortcut in the Registry. Here you need to specify the path to the executive file.
  • The opposite situations also occur - Startup is disabled, but each time the software starts automatically. This usually happens with antiviruses and firewalls. They have increased startup priority. In this case, you need to go to the defender settings and disable autorun. Alternatively, you can deactivate these programs or completely remove them from your computer.

    simple bash-like aliases on Windows

    To get global bash-like aliases on Windows for applications not automatically added to the path without manually adding each one to the path, here's the cleanest solution I've come up with that makes the least amount of changes to the system and has the most flexibility for later customization:

    "Set" Your Aliases Path

    Add Your Nickname

    open in a new shell Window

    start C:path tomy program.exe , passing all arguments, opening it in a new window, create a c:aliasesmy program.bat file with the following contents (see the NT startup command for details on the start commmand):

    execute in current shell window

    start C:path tomy program.exe , passing all arguments but running it in the same window (more like how bash works) create c:aliasesmy program.bat file with the following contents:

    Rating
    ( 1 rating, average 5 out of 5 )
    Did you like the article? Share with friends:
    For any suggestions regarding the site: [email protected]
    Для любых предложений по сайту: [email protected]