title: How to add zero in front of a variable in a batch file?
body: <p>I need to add a zero in front of a variable, but I need to compare two variables before making it. After that, another treatment will reduce the number of digits in each variable, but first I need them to be intact. Why? because in my actual Batch File, my latest version won't being installed because it sees the latest version like if it was older than the installed one and it is false.</p>
  <p>It happens because the reduction only keep the first 5 digits of each variable. In this problem, the variable of the installed version became greater than the newest version and of course I don't want this, that is why I want to add a zero in front of the installed one but only if the number of digit are not the same like in this case.</p>
  <p>In my treatment, I extract the installed version number and place it into a variable and also for the newest version then I remove the dots in both and I reduce the numbers of digit to 5 or else when it comes to compare it won't work if the variable are too long. So I had this idea below to adjust the number of digit in both variable before the reducing but this part doesn't work.</p>
  <p>**Original Version before treatment : Installed_Version = 98.0.4758.82 and Version = 100.0.4896.88</p>
  <pre><code>set /A Trimmed_Installed_Version = 980475882
  set /A Trimmed_Version = 1000489688
  set /A Niveau = 1
  set Compare = %Trimmed_Version% / %Trimmed_Installed_Version%
  if &quot;%Compare%&quot; GTR &quot;%Niveau%&quot;
      (
      do set Trimmed_Installed_Version = 0%Trimmed_Installed_Version%
      )
  echo %Trimmed_Installed_Version%
  </code></pre>
  <p>As you can see, the first two variables are what I have at this point in my treatment after an echo, I just reported it to this part's code. Any idea how to make this work or else I'm open to a better idea?</p>