Bat file to run a .exe at the command prompt

后端 未结 11 1536
萌比男神i
萌比男神i 2020-12-04 08:09

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:800         


        
相关标签:
11条回答
  • 2020-12-04 08:29

    Well, the important point it seems here is that svcutil is not available by default from command line, you can run it from the vs xommand line shortcut but if you make a batch file normally that wont help unless you run the vcvarsall.bat file before the script. Below is a sample

    "C:\Program Files\Microsoft Visual Studio *version*\VC\vcvarsall.bat"
    svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service
    
    0 讨论(0)
  • 2020-12-04 08:36

    What's stopping you?

    Put this command in a text file, save it with the .bat (or .cmd) extension and double click on it...

    Presuming the command executes on your system, I think that's it.

    0 讨论(0)
  • 2020-12-04 08:38

    As described here, about the Start command, the following would start your application with the parameters you've specified:

    start "svcutil" "svcutil.exe" "language:cs" "out:generatedProxy.cs" "config:app.config" "http://localhost:8000/ServiceModelSamples/service"
    
    • "svcutil", after the start command, is the name given to the CMD window upon running the application specified. This is a required parameter of the start command.

    • "svcutil.exe" is the absolute or relative path to the application you want to run. Using quotation marks allows you to have spaces in the path.

    • After the application to start has been specified, all the following parameters are interpreted as arguments sent to the application.

    0 讨论(0)
  • 2020-12-04 08:39

    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.

    0 讨论(0)
  • 2020-12-04 08:41

    Just stick in a file and call it "ServiceModelSamples.bat" or something.

    You could add "@echo off" as line one, so the command doesn't get printed to the screen:

    @echo off
    svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://localhost:8000/ServiceModelSamples/service
    
    0 讨论(0)
  • 2020-12-04 08:43

    A bat file has no structure...it is how you would type it on the command line. So just open your favourite editor..copy the line of code you want to run..and save the file as whatever.bat or whatever.cmd

    0 讨论(0)
提交回复
热议问题