Why does a working batch command only partially work when redirected? -
i'm writing batch script that, among other things, opens macro enabled excel file (.xlsm):
2>nul ( >>%csf% echo off ) && (start "cmdtitle" /b excel %csf% /e /automation) || (echo not open)
%csf% variable referring full path excel file i.e. "c:\test\testfile.xlsm" (including quotes cases there may spaces in directory / filename)
this code checks if file locked editing, if not opens file (start command) otherwise echos not open.
if open file windows explorer or run following in batch script file opens fine.
set csf="c:\test folder\test.xlsm" start "cmdtitle" /b excel %csf% /e /automation
however, running batch file when checking locked file causes excel say, "excel found unreadable content in 'filename.xlsm' want recover contents of workbook?" removes macros file.
edit: in addition file not opening correctly, excel add-ins upon excel opening, example, removing , recreating command bar fail load: "addin.xla cannot accessed"
what causing difference in behavior between running command alone , in redirection? tia
examine end of file in hex viewer , see what, if anything, appended end.
your code posted works fine (echoing excel command too). other code problem.
Comments
Post a Comment