none
Need help creating a bat file to run a cmd file.

    Question

  • I can run the cmd file manually by opening the VS2012 command prompt, and entering these commands to move the prompt to the correct folder on the d drive:

    d:
    cd /SomeFolder

    now from the prompt I can run the next command to create 3 files:
    svcutil /t:metadata http://localhost/VelocityPrototype.Web/WebServices/vFileCacheUtility/vFileCacheUtilityService.svc

    and lastly I run this command using those 3 file names to create the 2 files I'm after:
    svcutil tempuri.org.wsdl tempuri.org.xsd schemas.microsoft.com.2003.10.Serialization.xsd

    How can I create a bat file to run a cmd file to do this?
    Thanks.

    Friday, November 20, 2015 3:11 AM

Answers

  • Hi moondaddy,

    Actually this forum just discuss the VS Editor usage, we don't support this command line tools even if it is included in the VS IDE/WDK. But I really want to provide the helpful information I got in my side.

    I refer to the thread I replied about the MSTest.exe command line for testing project here:

    https://social.msdn.microsoft.com/Forums/en-US/8f9cf437-b175-4b6d-9baa-04dc1bb66e1d/any-commandline-option-to-overwrite-existing-resultsfile-when-same-test-is-run-using-mstest?forum=vsautotest

    For example, I got the svcutil.exe in my local machine here:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools

    To run the svcutil.exe in the bat file, I write it using the sample way:

    cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools"
    SvcUtil.exe/?pause.

    If I open the bat file, I will get the result like the follow screen shot:

    At least, it would run this command line in the bat file even if it is not the real command lines as yours. I didn't use this command line before, but maybe you could share me a simple project sample which could really uses this tool, I will help you test it in my side. Of course, if possible, you could refer to the simple sample as the above steps, maybe it could provide your a better direction for this issue.

    If I have misunderstood this issue, please feel free to let me know.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 25, 2015 6:58 AM
    Moderator

All replies

  • Hi moondaddy,

    Actually this forum is to discuss:

    Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    So I'm afraid that it is not the VS IDE usage issue if you want to write a bat file to run the cmd.

    To open the cmd file, we could use the way in a bat file:

    c:\
    cd %windir%\system32\
    start cmd

    I also found some documents/threads which shared us how to write a simple batch file, if possible, you could check it in your side.

    http://stackoverflow.com/questions/16727941/how-to-execute-cmd-commands-through-batch-file

    http://www.makeuseof.com/tag/write-simple-batch-bat-file/

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 23, 2015 3:40 AM
    Moderator
  • Thanks Jack, but this doesn't help.  I'm using this forum because svcutil is a VS tool - and I need to run it from a bat file (more like execute a cmd file which uses svcutil from the bat file).

    Also, I've already seen those links and they did not help.

    I'm using VS 2013.  Can anyone please help me create the bat file to execute the cmd file?  I can manually do all of this from the VS2013 command prompt by moving the prompt to the correct folder in the D drive.  Then I can execute this line (which is what should be in the cmd file) in the command window and all is good:

    svcutil.exe http://localhost/VelocityPrototype.Web/WebServices/vFileCacheUtility/VFileCacheUtilityService.svc?wsdl

    Thank you.

    Tuesday, November 24, 2015 3:39 AM
  • Hi moondaddy,

    Actually this forum just discuss the VS Editor usage, we don't support this command line tools even if it is included in the VS IDE/WDK. But I really want to provide the helpful information I got in my side.

    I refer to the thread I replied about the MSTest.exe command line for testing project here:

    https://social.msdn.microsoft.com/Forums/en-US/8f9cf437-b175-4b6d-9baa-04dc1bb66e1d/any-commandline-option-to-overwrite-existing-resultsfile-when-same-test-is-run-using-mstest?forum=vsautotest

    For example, I got the svcutil.exe in my local machine here:

    C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools

    To run the svcutil.exe in the bat file, I write it using the sample way:

    cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools"
    SvcUtil.exe/?pause.

    If I open the bat file, I will get the result like the follow screen shot:

    At least, it would run this command line in the bat file even if it is not the real command lines as yours. I didn't use this command line before, but maybe you could share me a simple project sample which could really uses this tool, I will help you test it in my side. Of course, if possible, you could refer to the simple sample as the above steps, maybe it could provide your a better direction for this issue.

    If I have misunderstood this issue, please feel free to let me know.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 25, 2015 6:58 AM
    Moderator