Page 1 of 1

Execution from command line and cmd-file

Posted: 02 Jun 2018 18:53
by zakhar
Hello, XY-Forum!
Why can xyplorer execute a script from a command line command and do not execute the same script from a cmd-file?

Re: Execution from command line and cmd-file

Posted: 02 Jun 2018 19:30
by jupe
If you mean in a batch file, I don't have problems running XY commands contained within a batch file, it works just like from the command line for me, what exactly is the problem you are having?

Re: Execution from command line and cmd-file

Posted: 02 Jun 2018 23:18
by zakhar
jupe wrote:what exactly is the problem you are having?
Hi, jupe!
Something stupid happens.

I have an x.cmd that call xyplorer twice to run two scripts:
C:\...\xyplorer.exe /new /win=min /script="1.xys"
C:\...\xyplorer.exe /new /win=min /script="2.xys"
and it runs normally, xy returns to the x.cmd and x.cmd runs further.
Then the x.cmd contains a next call
C:\...\xyplorer.exe /new /win=min /script="3.xys"
and all ends: xyplorer can't be seen running and x.cmd ends abruptly on the command that calls xyplorer.
This 3.xys is ok itself: xyplorer runs it from "Scripting/Run script".
If I write a simple y.cmd that contains only the call
C:\...\xyplorer.exe /new /win=min /script="3.xys"
so the 3.xys will be completed normally.
It will run too if I start command line window and type the same command
C:\...\xyplorer.exe /new /win=min /script="3.xys"
manually.
I have even tested this situation by emptying the 3.xys by adding /* and */ for the whole content of the 3.xys to be sure that the script is not responsible for failures and nothing changes. :eh:

There is also another problem that I experienced:
7-Zip and rar.exe do not run in that x.cmd, if they are called after these scripts 1.xys and 2.xys .
Rar.exe complains to not have permission to create temporary archives and 7-Zip seems to have same problems.
At the same time being started by the same commands but from an z.cmd containing only the call to xyplorer
these both 7-Zip and rar.exe work good.

Re: Execution from command line and cmd-file

Posted: 03 Jun 2018 10:24
by zakhar
I have just discovered, that the structure in a.cmd

Code: Select all

if ddd (
command1
command2=C:\ ... \xyplorer.exe /new /win=min /script=a.xys
command3
)
does not work=a.xys will not start and a.cmd ends abruptly - as I see due to the syntax of xyplorer's command, the braces in the a.cmd structure do not work.
If the above code is written as

Code: Select all

if ddd command1
if ddd command2=C:\ ... \xyplorer.exe /new /win=min /script=....xys
if ddd command3
then a.xys will be completed normally and xyplorer then returns to the a.cmd.

Strange behavior. It does not occurs if other dos commands are in such () structures.

Re: Execution from command line and cmd-file

Posted: 03 Jun 2018 19:14
by highend
And it works fine within a braces structure here...

Code: Select all

SET "test=True"

If /i "%test%" == "true" (
	"R:\XYplorer_fresh\xyplorer.exe" /new /win=min /script=a.xys
	"R:\XYplorer_fresh\xyplorer.exe" /new /win=min /script=b.xys
	"R:\XYplorer_fresh\xyplorer.exe" /new /win=min /script=c.xys
)
While a.xys contains:

Code: Select all

    new("R:\XYplorer_fresh\a.txt");
b and c the same vice versa, only with their letter for the new file...

Re: Execution from command line and cmd-file

Posted: 03 Jun 2018 23:17
by zakhar
Thank you, highend.
Something wrong is here in my command line.
I can not find out what it is. And the probability is very high it hangs not on xyplorer.
Therefore I don't think it is appropriate to employ this forum this such problems.
This topic can be deleted, if there is no interest to keep it :|

Re: Execution from command line and cmd-file

Posted: 03 Jun 2018 23:47
by highend
Post the REAL content of the .cmd file and the real contents of all involved script files...

Re: Execution from command line and cmd-file

Posted: 04 Jun 2018 01:35
by zakhar
Dear highend!
As I wrote above I see that the problem is not in xyplorer or in its scripts written by me.
The problem is my cmd-file writing, which I would like to master by myself.
The responsivity of xyplorer's forum is in no way in doubt :)

Re: Execution from command line and cmd-file

Posted: 04 Jun 2018 05:03
by highend
The problem is my cmd-file writing
I doubt that, hence my questions...