title: Why does winexe error out when executing this .bat script?
body: <p>I've done some searching and found references to a neat little tool called winexe (which is great, since psexec is exactly what I was looking to emulate), but it's not QUITE working the way I'd like...</p>
  
  <p>What I'm trying to do is automate my memory dumping process (which I typically do manually on my windows machine) by scripting it in bash.I copy a Redline folder over to the target, connect with psexec, and then run the .bat script. Works great. Tried it from my Linux machine, and it works if I connect winexe with cmd.exe and run the .bat manually... </p>
  
  <p>The problem, is that if I try to do something like:</p>
  
  <pre><code>winexe -U=username%password //hostname 'cmd.exe /c C:\Temp\Redline\RunRedlineAudit.bat'
  </code></pre>
  
  <p>- or -</p>
  
  <pre><code>winexe -U=username%password //hostname C:/Temp/Redline/RunRedlineAudit.bat
  </code></pre>
  
  <p>It kicks back:</p>
  
  <pre><code>Failure Encountered:
  Privilege Escalation Script and/or Helper Script not found.
  </code></pre>
  
  <p>Any thoughts on what the problem could be and how to fix it? So far I'm thinking I may just script all the way up to the cmd.exe connect, and then do that very last step manually, but that's no fun ;)</p>
  
  <p>The batch script:</p>
  
  <pre><code>@ECHO off
  SETLOCAL enableextensions enabledelayedexpansion
  SET elevate=.\elevate.cmd
  SET helper\.\Helper.bat
  SET args=%1
  
  IF NOT EXIST "%elevate%" goto :failed
  IF NOT EXIST "%helper%" goto :failed
  
  For /f "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)
  For /f "tokens=2,3,4 delims=. " %%G in ('echo %_version%') Do (set _major=%%G&amp; set _minor=%%H&amp; set _build=%%I)
  
  if "%_major%"=="5" goto sub5
  if "%_major%"=="6" goto sub6
  Echo unsupported OS version
  goto:eof
  :sub5
  call %helper% %args%
  GOTO :end
  :sub6
  ECHO Requesting Elevation
  call %elevate% %helper% %args%
  GOTO :end
  
  :failed
  :ECHO.
  :ECHO.
  ECHO Failure Encountered:
  ECHO Privilege Escalation Script and/or Helper Script not found.
  GOTO :end
  
  :end
  ENDLOCAL
  @ECHO on
  </code></pre>