PDA

View Full Version : sencha.bat run twice



ralscha
8 Mar 2012, 10:13 AM
Hi

I had a small problem with sencha.bat from the windows sdk (c:\SenchaSDKTools-2.0.0-Beta\bin\sencha.bat). I always had to start the batch file twice. This is because of variable expansion at parse time. The variables sdkpath and dir had their values set the first time but are not expanded inside the if statement. The second time the variables are set.

Here is a description about this problem:
http://superuser.com/questions/78496/variables-in-batch-file-not-being-set-when-inside-if
(http://superuser.com/questions/78496/variables-in-batch-file-not-being-set-when-inside-if)
Here the changed version of sencha.bat. With this changes I only have to start sencha.bat once


@echo off
setlocal enabledelayedexpansion


IF EXIST .senchasdk (
SET /P sdkpath= < .senchasdk

"!sdkpath!\command\sencha" %*
) ELSE (
set dir=%~dp0
jsdb -path "!dir!..\command" "!dir!..\command\sencha.js" %*
)