Skip to content

Allow Direct Raw quotes and backslash in StringList #69

@almounah

Description

@almounah

Hey,

Thanks for the project, peak work !

I have this usecase where I need to put double quotes in my command.

What I enter in grumble shell:

powercliff exec Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList "/temp/main_http.exe" -ComputerName 172.20.0.52

The layout is:

[Session 13: INLANEFREIGHT\Helen@SRV02] » powercliff exec --help

Exec a powershell cmd

Usage:
  exec [flags] [args...]

Args:
  args  string list    Argument of the Assembly

In my code, I ofc what to get back the Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList "/temp/main_http.exe" -ComputerName 172.20.0.52 to use it.

To do that I just use

 argString := ""
argStringList := c.Args.StringList("args")
for i := 0; i < len(argStringList); i++ {
	argString += argStringList[i]
	argString += " "
}

However argString variable is

Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList /temp/main_http.exe -ComputerName 172.20.0.52

And not

Invoke-WmiMethod -Class Win32_Process -Name Create -ArgumentList "/temp/main_http.exe" -ComputerName 172.20.0.52

Same behavior is seen when using \, the \ just disappear too !

A workaround is to escape the " into \" when entering the command and \ into \\.

I was wondering if this behavior is coming from my shell or grumble anf if anything can be done to avoid escaping quotes and \ and just treat them, as normal characters.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions