Execute command problem

Post Reply
beber005
Posts: 57
Joined: Mon Mar 03, 2014 2:18 pm
OLAP Product: Cognos
Version: 9.5.1
Excel Version: 2010

Execute command problem

Post by beber005 »

Hi everyone,

Yesterday I posted in the forum a problem. This one was about "how to copy a file after another one" I mean the content. For this I'm trying to use Execute command to use windows command. My code is as follows :

Code: Select all

vFileName1 = 'Y:\1-ENTREE\ImportSAP\Toto1.csv';
vFileName2 = 'Y:\1-ENTREE\ImportSAP\Toto2.csv';
vCmd = 'copy ' | vFileName1 | ' ' | vFileName2 ;
ExecuteCommand (vCmd,0);
But TM1 says "Error: Prolog procedure line (52): The system cannot find the file specified." and I don't know how.At first I wanted to use the vbscript but I do not know if this is possible

Code: Select all

Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists("C:\test.txt") Then
    objFSO.CopyFile "C:\test.txt" , "C:\test2.txt"
    Else
    MsgBox "Fichier C:\test.txt introuvable", vbExclamation
    End If
    Set objFSO = Nothing
Thanks a lot for your help :D
declanr
MVP
Posts: 1828
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: Execute command problem

Post by declanr »

I'm guessing the Y drive is one mapped on your pc, if it isnt mapped on the server then executing a command from the server wont find it. If thats the case you can map the Y drive on the server but preferably use the real path anyway.

To test it log onto the server as the account tm1/cx runs under and try and use the cmd prompt manually, when that works throw it into TI.
Declan Rodger
beber005
Posts: 57
Joined: Mon Mar 03, 2014 2:18 pm
OLAP Product: Cognos
Version: 9.5.1
Excel Version: 2010

Re: Execute command problem

Post by beber005 »

Actually you're right, the path that I gave was not supported by the server, so I changed this but it always returns me the same error localization file. In addition, I can not use the command prompt as administrator I am not my PC. Do you think it am because of that I can not use the command in TM1?
beber005
Posts: 57
Joined: Mon Mar 03, 2014 2:18 pm
OLAP Product: Cognos
Version: 9.5.1
Excel Version: 2010

Re: Execute command problem

Post by beber005 »

Okay I find a solution by using the file .bat to execute my windows CMD and it's working perfectly :)
Sebastian.Klein
Posts: 16
Joined: Mon Oct 15, 2012 3:49 pm
OLAP Product: TM1
Version: 10.2
Excel Version: 2010

Re: Execute command problem

Post by Sebastian.Klein »

I guess if you are using cmd /c copy .... as the command you would execute, it should work also. But executing a Batch-Script is also a good way :-)
German TM1 Consultant since 2008
dan.kelleher
Community Contributor
Posts: 128
Joined: Wed Oct 14, 2009 7:46 am
OLAP Product: TM1
Version: 9.4
Excel Version: 11
Location: London

Re: Execute command problem

Post by dan.kelleher »

Hi Beber,

One reason for this might be because TM1 still has the file open until it completes the tab that is writing to it. The file is actually named C:\test.txt$ until the tab code is complete. If you have TextOutput or ASCIIOutput in your prolog, try concatenating the files in the Epilog. This may not be the reason, but worth pointing out in this thread.

Having said that, I have also come across instances where the ExecuteCommand([my operation]) fails, and the solution is always to write [my operation] to a .bat, and execute the .bat via ExecuteCommand().

Thanks,

Dan
Post Reply