Salta al contenuto principale

Buggy pre/post command execution

Thread needs solution

Let's test following script (test.cmd):

@echo off
if not exist %~1 (
echo Directory %~1 NOT exist >>"test.log"
) else (
echo Directory %~1 exists >>"test.log"
)
echo. >>"test.log"

This script just tests specified in the first argument directory/file for existence and outputs resulting string to test.log. Here are the examples of execution:
1. test.cmd n:\backups
Result: Directory n:\backups exists

2. test.cmd n:\backups\
Result: Directory n:\backups\ exists

3. test.cmd n:\backups\foo
Result: Directory n:\backups\foo NOT exist (and that is true)

Now lets add that script as post command for any backup task (command: t:/test/test.cmd, work dir: t:/test, arguments: n:\backups\) and press Test button. The result written in test.log is: Directory n:\backups NOT exist

I also found that command execution as pre/post command fails in calling another cmd.exe, if's, for's. Why?!!! Why the result is so different?

0 Users found this helpful

A bit more information: N: is a mapped network drive. If i perform test for any local drive, then execution results are the same for test in acronis and direct script execution. Assume, that might be connected with this: http://forum.acronis.com/forum/22813#comment-73340 But dont know how, may be support could explain?

See the topic I specified above, there is information about this error. Topic might be closed.