Bat file to run a .exe at the command prompt

1,232,959

Solution 1

To start a program and then close command prompt without waiting for program to exit:

start /d "path" file.exe

Solution 2

You can use:

start "windowTitle" fullPath/file.exe

Note: the first set of quotes must be there but you don't have to put anything in them, e.g.:

start "" fullPath/file.exe

Solution 3

it is very simple code for executing notepad bellow code type into a notepad and save to extension .bat Exapmle:notepad.bat

start "c:\windows\system32" notepad.exe   

(above code "c:\windows\system32" is path where you kept your .exe program and notepad.exe is your .exe program file file)

enjoy!

Solution 4

Just put that line in the bat file...

Alternatively you can even make a shortcut for svcutil.exe, then add the arguments in the 'target' window.

Solution 5

If you want to be real smart, at the command line type:

echo svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service >CreateService.cmd

Then you have CreateService.cmd that you can run whenever you want (.cmd is just another extension for .bat files)

Share:
1,232,959

Related videos on Youtube

abatishchev
Author by

abatishchev

This is my GUID. There are many like it but this one is mine. My GUID is my best friend. It is my life. I must master it as I must master my life. Without me, my GUID is useless. Without my GUID I am useless.

Updated on July 01, 2020

Comments

  • abatishchev
    abatishchev almost 4 years

    I want to create a .bat file so I can just click on it so it can run:

    svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service
    

    Can someone help me with the structure of the .bat file?

  • Tom Wilson
    Tom Wilson about 9 years
    The 'first set of quotes' is merely the window title and is NOT required. It is however, best to specify the startup directory using /d start /d "fullpath" file.exe This ensures any dependent files are, e.g. a DLL, are found and loaded.
  • abatishchev
    abatishchev about 9 years
    @MehdiJ: sets home directory.
  • Karthi
    Karthi about 7 years
    its possible to run the bat file from web browser? like a javascript to call the bat file ??
  • abatishchev
    abatishchev about 7 years
    @Karthi: sorry, it's impossible
  • Roland
    Roland over 6 years
    @Karthi You do not want javascript to be able to run a bat file for security reasons.
  • MensSana
    MensSana over 5 years
    And instead of adding an @echo off as first line, you could simply add @ at beginning of line you don't want to be echoed...
  • m4l490n
    m4l490n about 5 years
    how do you wait for the program to exit?
  • Jules
    Jules over 2 years
    @m4l490n you can use /wait. For example: start /wait "c:\windows\system32" notepad.exe