Hi,
It turns out that on windows if you run a command with a windows command file you need to escape the % character as %%
In my case I could test freeze and thaw calls at the command line successfully as
..\bin\cache -s. -U%SYS ##Class(Backup.General).ExternalFreeze()
...but when my freeze script ran it would fail.
it turns out that a single '%' is striped when run in a windows command file, and it must be escaped as '%%' windows gets:
..\bin\cache -s. -USYS ##Class(Backup.General).ExternalFreeze()
So make sure your freeze and thaw scripts and include a double %%;
..\bin\cache -s. -U%%SYS ##Class(Backup.General).ExternalFreeze()
I hope this helps
Stephen
PS In the case of the documentation it is worth noting that the thaw command wont run because it lacks the double %% :
'freeze.cmd' (with correct escaping)
..\bin\cache -s. -U%%SYS ##Class(Backup.General).ExternalFreeze()
rem note that we need to check errorlevel from highest to lowest here....
if errorlevel 5 goto OK
if errorlevel 3 goto FAIL
echo errorlevel returned wrong value
goto END
:OK
echo SYSTEM IS FROZEN
goto END
:FAIL
echo SYSTEM FREEZE FAILED
:END
'thaw.cmd' (this will fail because the % will get stripped. ::sad face::)
rem Now unfreeze the system
..\bin\cache -s. -U%SYS ##Class(Backup.General).ExternalThaw()
Wow, thanks, thats a good tip!
Stephen, agree with you, those %% can be nasty, while it's possible to avoid them in this very case:
making the command syntax very similar to Linux one. In most other cases %% are inevitable; take a look at a small brief from real CMD script:
@Alexey Maslov Thanks!