csession with ##class command on a Windows machine

Hi community.

I'm trying to create a "setup" method to be called on a batch script but i'm getting the error <INVALID ARGUMENT> when I pass a string as an argument to this method.

The idea is to call the method with a folder as the parameter, for example:

##class(test.MyClass).MyMethod("D:\path\to\my\file.json")
 

My class (just for example)

Class test.MyClass

{

ClassMethod MyMethod(pFilePath)
{
Write pFilePath ,!
}

}

I'm using cmd as follows:

D:\>csession CACHE20172 -U %SYS ##class(test.MyClass).MyMethod(100)
100

If I use a number, It works, but any string value I get the error

D:\>csession CACHE20172 -U %SYS ##class(test.MyClass).MyMethod("test")

<INVALID ARGUMENT>>
D:\>csession CACHE20172 -U %SYS ##class(test.MyClass).MyMethod(\"test\")

<INVALID ARGUMENT>>
D:\>csession CACHE20172 -U %SYS ##class(test.MyClass).MyMethod(^"test^")

<INVALID ARGUMENT>>
D:\>csession CACHE20172 -U %SYS ##class(test.MyClass).MyMethod(""test"")

<INVALID ARGUMENT>>
D:\>csession CACHE20172 -U %SYS "##class(test.MyClass).MyMethod(\"test\")"

<INVALID ARGUMENT>>
D:\>csession CACHE20172 -U %SYS "##class(test.MyClass).MyMethod(^"test^")"

<INVALID ARGUMENT>>
D:\>csession CACHE20172 -U %SYS "##class(test.MyClass).MyMethod("""test""")"

<INVALID ARGUMENT>>

Any idea to solve this? I think it might be something very easy (maybe related to escaping chars), but i'm stuck with this for some hours.

On a Linux machine I could make it work, but on a Windows machine I was not able so far...

Thank you all

  • 0
  • 0
  • 85
  • 2
  • 2

Answers

Hi Thiago,

Try

D:\>csession CACHE20172 -U %SYS "##class(test.MyClass).MyMethod(""""""test"""""")"

Six quotes :-O

Trial and error or is there any logic behind that ?

Might help if you change it to

ClassMethod MyMethod(pFilePath as %String)