How to run a visual studio CMD command in a pipeline?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to run a visual studio CMD command in a pipeline?

jesus fernandez
I need to run a elevated x64 Native Tools Command Prompt fro VS 2019 command ("vcperf /start session") within my pipeline. I have tried different ways but I cannot make it work. This is what I tried last: 
pipeline {
    agent any

    stages {
        stage('test') {
            steps {
                script{
                    bat '"C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Visual Studio 2019/Visual Studio Tools/VC/x64 Native Tools Command Prompt for VS 2019.lnk" -vcperf /start session'
            
                }    
            }
        }
    }
}

but I get this output:
12:44:43 C:\Users\User\.jenkins\workspace\test>"C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Visual Studio 2019/Visual Studio Tools/VC/x64 Native Tools Command Prompt for VS 2019.lnk" vcvarsall.bat x86_amd64 
12:44:43 [ERROR:vcvarsall.bat] Invalid argument found : vcvarsall.bat 
12:44:43 [ERROR:vcvarsall.bat] Error in script usage. The correct usage is: 
12:44:43 Syntax: 
12:44:43 vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode] 
12:44:43 where : 
12:44:43 [arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64 
12:44:43 [platform_type]: {empty} | store | uwp 
12:44:43 [winsdk_version] : full Windows 10 SDK number (e.g. 10.0.10240.0) or "8.1" to use the Windows 8.1 SDK. 
12:44:43 [vc_version] : {none} for latest installed VC++ compiler toolset | 
12:44:43 "14.0" for VC++ 2015 Compiler Toolset | 
12:44:43 "14.xx" for the latest 14.xx.yyyyy toolset installed (e.g. "14.11") | 
12:44:43 "14.xx.yyyyy" for a specific full version number (e.g. "14.11.25503") 
12:44:43 [spectre_mode] : {none} for libraries without spectre mitigations | 
12:44:43 "spectre" for libraries with spectre mitigations 
12:44:43 The store parameter sets environment variables to support Universal Windows Platform application 
12:44:43 development and is an alias for 'uwp'. 
12:44:43 For example: 
12:44:43 vcvarsall.bat x86_amd64 
12:44:43 vcvarsall.bat x86_amd64 10.0.10240.0 
12:44:43 vcvarsall.bat x86_arm uwp 10.0.10240.0 
12:44:43 vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0 
12:44:43 vcvarsall.bat x64 8.1 
12:44:43 vcvarsall.bat x64 store 8.1  

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e6d5397e-076d-406e-8c24-fa23a801a644n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to run a visual studio CMD command in a pipeline?

Victor Martinez
If you run the same command in your terminal, does it work? Does it need any kind of UI access?

On Monday, 26 October 2020 at 11:55:23 UTC [hidden email] wrote:
I need to run a elevated x64 Native Tools Command Prompt fro VS 2019 command ("vcperf /start session") within my pipeline. I have tried different ways but I cannot make it work. This is what I tried last: 
pipeline {
    agent any

    stages {
        stage('test') {
            steps {
                script{
                    bat '"C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Visual Studio 2019/Visual Studio Tools/VC/x64 Native Tools Command Prompt for VS 2019.lnk" -vcperf /start session'
            
                }    
            }
        }
    }
}

but I get this output:
12:44:43 C:\Users\User\.jenkins\workspace\test>"C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Visual Studio 2019/Visual Studio Tools/VC/x64 Native Tools Command Prompt for VS 2019.lnk" vcvarsall.bat x86_amd64 
12:44:43 [ERROR:vcvarsall.bat] Invalid argument found : vcvarsall.bat 
12:44:43 [ERROR:vcvarsall.bat] Error in script usage. The correct usage is: 
12:44:43 Syntax: 
12:44:43 vcvarsall.bat [arch] [platform_type] [winsdk_version] [-vcvars_ver=vc_version] [-vcvars_spectre_libs=spectre_mode] 
12:44:43 where : 
12:44:43 [arch]: x86 | amd64 | x86_amd64 | x86_arm | x86_arm64 | amd64_x86 | amd64_arm | amd64_arm64 
12:44:43 [platform_type]: {empty} | store | uwp 
12:44:43 [winsdk_version] : full Windows 10 SDK number (e.g. 10.0.10240.0) or "8.1" to use the Windows 8.1 SDK. 
12:44:43 [vc_version] : {none} for latest installed VC++ compiler toolset | 
12:44:43 "14.0" for VC++ 2015 Compiler Toolset | 
12:44:43 "14.xx" for the latest 14.xx.yyyyy toolset installed (e.g. "14.11") | 
12:44:43 "14.xx.yyyyy" for a specific full version number (e.g. "14.11.25503") 
12:44:43 [spectre_mode] : {none} for libraries without spectre mitigations | 
12:44:43 "spectre" for libraries with spectre mitigations 
12:44:43 The store parameter sets environment variables to support Universal Windows Platform application 
12:44:43 development and is an alias for 'uwp'. 
12:44:43 For example: 
12:44:43 vcvarsall.bat x86_amd64 
12:44:43 vcvarsall.bat x86_amd64 10.0.10240.0 
12:44:43 vcvarsall.bat x86_arm uwp 10.0.10240.0 
12:44:43 vcvarsall.bat x86_arm onecore 10.0.10240.0 -vcvars_ver=14.0 
12:44:43 vcvarsall.bat x64 8.1 
12:44:43 vcvarsall.bat x64 store 8.1  

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/6a879dcc-1a6d-4256-a2e0-b80452284f57n%40googlegroups.com.