discovery pattern - debug mode - command prompt - space in the name of directory to be listed

Renata7
Tera Contributor

Hi 

I am trying to run command on Windows system from Discovery pattern -> debug mode -> command prompt.

Renata7_0-1721388429215.png

 

I want to list directory 'c:\Program Files' (in the directory name there is a space).
There is no problem in listing directory where no space character is there, but when ' ' is in place - I face the issue.

The ways I tried to list directory - but with no success:
dir 'c:\Program Files'
dir c:\Program` Files
dir c:\'Program Files'
dir c:\Program^ Files

Do you have ideas how to solve that and successfully list the directory with space character in the name?

Kind regards
Renata Sieczka-Parcej

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Renata7 , 

 

There is an alternative approach to view file folders inside c:\programfiles inside the pattern designer debug mode.

 

step1 : create a step in the pattern designer and choose ' parse file' operation

step 2: click on browse button on the screen. then you can view all the files folders on that windows server. 

 

Please refer to the attached screenshot. 

 

Please mark my solution as helpful, if it is resolving your problem.

View solution in original post

4 REPLIES 4

Aneesh-D
Tera Guru
Tera Guru

@Renata7 - This was little tricky..

This will do the trick for you: 

dir + " \"/Program Files\""

Before running the command, midserver actually enforces the usage of chcp 65001 in cmd. The actual command for the above would look like this.

cmd /c "chcp 65001 & dir "/Program Files" >> output_6db22650-f8c5-421d-8518-35e3b697ce5a.txt

 

you can test your command string by setting chcp 65001 in local cmd terminal [default might be likely 437]

AneeshD_0-1721411296549.png

 

Community Alums
Not applicable

Thank you for sharing @Aneesh-D ! This is definitely geek stuff!

Community Alums
Not applicable

Hi @Renata7 , 

 

There is an alternative approach to view file folders inside c:\programfiles inside the pattern designer debug mode.

 

step1 : create a step in the pattern designer and choose ' parse file' operation

step 2: click on browse button on the screen. then you can view all the files folders on that windows server. 

 

Please refer to the attached screenshot. 

 

Please mark my solution as helpful, if it is resolving your problem.

Iklef
Tera Contributor

Hi @Renata7,

When you type the command :

dir /X

The result gives you the shortname of the folder as well as the long ones :

example

07/05/2022 07:24 <DIR> PerfLogs
20/05/2025 08:18 <DIR> PROGRA~1 Program Files
20/05/2025 14:56 <DIR> PROGRA~2 Program Files (x86)

 

You can then use the short name (the one with the ~). example :

dir c:\progra~1

Hope this helps !

Iklef