33771

Jenkins execute windows batch Path issue and redirected output

Question:

We have a windows bat script that works fine in windows. When run under Jenkins we have to run the embedded program in quoted string this causes the output to only be seen till after completion of the command. When run in a real windows cmd.exe the output come out when the text is found continues to run. We see the program is in the path directory and we also add the path statement before execution. "C:\MyPrograms\;%path%". What causes Jenkins to save the output till after execution completes and why does the program have to be quoted when the program is in the path? We are using SVN | Grep and we get prorgam not found unless its is a quoted string with full path. "c:\Tortoise\Svn.exe parms | "C:\Myprogram\grep.exe" "string" " works with no output till the end. c:\Tortoise\Svn.exe parms | grep.exe "string" prorgam\command not found when the path is visibble in the echo "%path% command. Any ideas?

Answer1:

How and more importantly <strong>when</strong> are you setting the path? As part of the job or as a separate step outside the job?

In any case, you wrote: <em>"C\MyPrograms\;%path%"</em><br /> First, I hope it is a typo on your part, but you need the colon (:) after C.<br /> Second, you set the path with a set command, like so:<br />set PATH=%PATH%;C:\MyPrograms

Now the important part. Setting the path like this from command line is <strong>not permanent</strong> and will only last for the duration of this cmd.exe session. So, if you are doing this as part of the job, then that's fine. But if you are doing it separately from command line, that is not permanent and not available when Jenkins runs.

You can permanently set the path for the system by following the answer here <a href="https://superuser.com/questions/317631/setting-path-in-windows-7-command-prompt" rel="nofollow">https://superuser.com/questions/317631/setting-path-in-windows-7-command-prompt</a>

Recommend

  • TortoiseProc launch failed Error:The requested operation requires elevation
  • Correct way to install Mercurial on Ubuntu
  • Merge some files now and some later
  • How to revert a subversion import?
  • How to tell if someone has downloaded the latest code
  • view comments in repository using tortoise svn
  • Eclipse SVN Subclipse Tortoise Force Lock
  • SVN and renaming the server it's running on
  • add and remove classes in order with jQuery
  • Finding matching phrases between two pieces of text?
  • Wait for a SLOT to finish the execution with Qt
  • Calculate all possible factors of a prime
  • .NET video play library which allows to change the playback rate?
  • C#: Import/Export Settings into/from a File
  • How to 'create temp table as select' in Slick?
  • Redshift Querying: error xx000 disk full redshift
  • Bash if statement with multiple conditions
  • How to remove a SwiftyJSON element?
  • Web.config system.webserver errors
  • MySQL Order by column = x, column asc?
  • How can I set a binding to a Combox in a UserControl?
  • AJAX Html Editor Extender upload image appearing blank
  • Swift: Switch statement fallthrough behavior
  • Checking free space on FTP server
  • Change Inet root folder for iis 7
  • script to move all files from one location to another location
  • MySQL WHERE-condition in procedure ignored
  • ILMerge & Keep Assembly Name
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • Updated Ionic CLI but shows previous version (Windows)
  • Symfony2: How to get request parameter
  • Weird JavaScript statement, what does it mean?
  • Web-crawler for facebook in python
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • trying to dynamically update Highchart column chart but series undefined
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • Android Google Maps API OnLocationChanged only called once
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal