Exe created out of bat file using iexpress fails to execute

361 views Asked by At

I have a batch file invoking the "sqlcmd" drop and create procedure commands, it works fine on executing just the bat file. But when the .bat file is converted executable using iexpress(Windows tool), the application fails to run with the below mentioned error.

I tried converting "bat file executing sql script for the Database creation" into exe using iexpress and it worked fine. But drop and create procedure commands are failing.

Am trying create an exe from batch file, using iexpress tool. During package all the dependendency files are included into the package. My issue is in creating the exe from "CreateProcedure.bat". Suggestions and solutions are appreciated.

CreateDB.bat

set path=C:\Program Files (x86)\Microsoft SQL Server\Client 
SDK\ODBC\110\Tools\Binn;%path%
sqlcmd -U sa -P texas#2019 -i CreateDB.sql

CreateDB.sql

GO
CREATE DATABASE TEX
ON
( NAME = TEX_Data,
  FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TEX_Data.MDF',
  SIZE = 500,
  MAXSIZE = 500, 
  FILEGROWTH = 0 )
LOG ON
( NAME = TEX_Log,
  FILENAME = 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\TEX_Log.LDF',
  SIZE = 250,
  MAXSIZE = 250, 
  FILEGROWTH = 0 )
GO
USE TEX
GO
CREATE LOGIN texas WITH PASSWORD = 'texas',CHECK_POLICY = OFF
GO
USE TEX
GO
sp_adduser 'texas'
GRANT 
 BACKUP DATABASE,
 BACKUP LOG,
 CREATE DEFAULT,
 CREATE FUNCTION,
 CREATE PROCEDURE,
 CREATE RULE,
 CREATE TABLE,
 CREATE VIEW 
 TO iris; 
ALTER DATABASE TKO SET RECOVERY SIMPLE
GO

CreateProcedure.bat

USE master
sqlcmd -U texas -P texas -Q "drop table staging"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_old"
sqlcmd -U texas -P texas -Q "drop procedure sp_import"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_from_old"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging"
sqlcmd -U texas -P texas -Q "drop procedure sp_export"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_4_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_4_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_export_no_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_export_4_TEX"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX_Rel_4"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX_Rel_4"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_4_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_4_TEX_Rel_5"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_no_TEX_Rel_6"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_no_TEX_Rel_6"
sqlcmd -U texas -P texas -Q "drop procedure sp_import_4_TEX_Rel_6"
sqlcmd -U texas -P texas -Q "drop procedure sp_staging_4_TEX_Rel_6"
sqlcmd -U texas -P texas -d TEX -i sp_staging_old.sql
sqlcmd -U texas -P texas -d TEX -i sp_import.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_from_old.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_4.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_5.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_6.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_no_TEX_Rel_7.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX_Rel_5.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX_Rel_6.sql
sqlcmd -U texas -P texas -d TEX -i sp_import_4_TEX_Rel_7.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_4.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_5.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_6.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX_Rel_7.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_no_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_4_TEX.sql
sqlcmd -U texas -P texas -d TEX -i sp_staging_4_TEX_Rel_5.sql

Error:

"Windows cannot access the specified device, path, or file. You may not 
have the appropriate permissions to access the item"

Also the following notification from antivirus program:
"A Process was blocked because malicious behaviour was detected"
0

There are 0 answers