Cannot run "Run Command-line utility"

Discuss RoboTask here
Post Reply
hongkwok
Posts: 4
Joined: Mon Nov 23, 2015 8:31 am

Cannot run "Run Command-line utility"

Post by hongkwok »

I cannot run "Run Command-line utility"
Please help

the test.bat is simple:

Code: Select all

echo %USERNAME%
Here is the log
I: 9/6/2016 7:27:30 PM: ****** Starting task: Test ******************
I: 9/6/2016 7:27:30 PM: Executing "1.Run command-line utility: test.bat "
E: 9/6/2016 7:27:30 PM:
E: 9/6/2016 7:27:30 PM: An error occurred. Step #1 (Run command-line utility: test.bat ).
I: 9/6/2016 7:27:30 PM: Task executed successfully

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1476211084
Comment=STRINGLIST
ContinueOnError=INTEGER|1
ExternalName=STRING|"Task34"
Hide=INTEGER|0
ID=INTEGER|938281814
LogOnAsUser=INTEGER|1
Name=STRING|"Test"
OnErrorTaskID=INTEGER|200524284
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER

[Actions\Action1]
ActionID=STRING|"A_MISC_RUNCONSOLEAPP"
Enabled=INTEGER|-1
Name=STRING|"Run command-line utility: test.bat "
Params=FOLDER

[Actions\Action1\Params]
convertansi=STRING|"0"
ifnonzero=STRING|"0"
program=STRING|"C:\Batch\test.bat"
saveexitcode=STRING|"0"
saveoutput=STRING|"0"
workdir=STRING|"C:\Batch"

Oleg
Site Admin
Posts: 3010
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Cannot run "Run Command-line utility"

Post by Oleg »

What operating system do you use?
Windows 10 do this without problems.

Try to run batch file via command interpreter (cmd.exe)

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1639840329
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task42"
Hide=INTEGER|0
ID=INTEGER|291196667
LogOnAsUser=INTEGER|1
Name=STRING|"Run command-line utility: test.bat ..."
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER

[Actions\Action1]
ActionID=STRING|"A_MISC_RUNCONSOLEAPP"
Enabled=INTEGER|-1
Name=STRING|"Run command-line utility: cmd.exe /c ""D:\Temp\test.bat"""
Params=FOLDER

[Actions\Action1\Params]
convertansi=STRING|"0"
ifnonzero=STRING|"0"
outputvar=STRING|"out"
params=STRING|"/c ""D:\Temp\test.bat"""
program=STRING|"cmd.exe"
saveexitcode=STRING|"0"
saveoutput=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{out}"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"{out}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Oleg Yershov
hongkwok
Posts: 4
Joined: Mon Nov 23, 2015 8:31 am

Re: Cannot run "Run Command-line utility"

Post by hongkwok »

It works
I'm using server 2012 R2

Why do I have to add cmd.exe there?
Oleg
Site Admin
Posts: 3010
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Cannot run "Run Command-line utility"

Post by Oleg »

Generally this action is for command-line utilities (that is EXE files)
BAT or CMD file is not an standalone executable file. It is only a text script.
System runs the CMD.EXE to perform this script in any case.

BTW I just tested the task without CMD.EXE (run test.bat directly) on our test Windows Server 2012 Standard
It works!
Oleg Yershov
hongkwok
Posts: 4
Joined: Mon Nov 23, 2015 8:31 am

Re: Cannot run "Run Command-line utility"

Post by hongkwok »

It worked fine in my 2012 R2 last week.
But I don't know why it fail this week.
It requires cmd.exe this week
Can you guess why?
thanks
Oleg
Site Admin
Posts: 3010
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Cannot run "Run Command-line utility"

Post by Oleg »

Probably some system settings (or 3-rd party software like as antivirus)
Unfortunately I can't say something more particular.
Oleg Yershov
Post Reply