Query adding Spaces after it is compiled

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
iampedro
Posts: 5
Last visit: Tue Aug 27, 2019 6:11 am

Query adding Spaces after it is compiled

Post by iampedro »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: 5.5.154
32 or 64 bit version of product: 64
Operating system:
32 or 64 bit OS: 64

#search directory and store uin.mdb into variable
$test = (get-childitem "C:\ROWriterData" -Recurse -include ?????.mdb -Exclude "Ishop.mdb") | select name
$test2string = $test | Out-String
$testtrim = $test2string.Trim()
$testrefine = $testtrim.Remove(0, 286)

#create registry entries
New-Item -Path HKCU:\Software -Name "Progressive Automotive Systems" –Force
New-Item -Path "HKCU:\Software\Progressive Automotive Systems" -Name "R.O. Writer" –Force
New-ItemProperty -Path "HKCU:\SOFTWARE\Progressive Automotive Systems\R.O. Writer" -Name "DataPath" -Value "C:\ROWriterData" -Force

When I compile this with setting in the attached screen shot it add's spaces instead of removing them.

DO NOT POST SUBSCRIPTIONS, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
Attachments
Ashampoo_Snap_Wednesday, August 29, 2018_10h47m43s_002_.jpg
Ashampoo_Snap_Wednesday, August 29, 2018_10h47m43s_002_.jpg (78.94 KiB) Viewed 3271 times
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 11:13 am
Answers: 39
Been upvoted: 30 times

Re: Query adding Spaces after it is compiled

Post by brittneyr »

Trim only removes the leading and trailing spaces of a string. If you want all spaces removed, use the following line:
$test2string = $test2string.Replace( ' ', '')
Brittney
SAPIEN Technologies, Inc.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Query adding Spaces after it is compiled

Post by Alexander Riedel »

From your post it is not really clear where you see spaces added.
Packaging does not modify your code, so I am not sure how spaces would be added.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
iampedro
Posts: 5
Last visit: Tue Aug 27, 2019 6:11 am

Re: Query adding Spaces after it is compiled

Post by iampedro »

When I compile it as a EXE and then run it, then it puts extra spaces inside of the Registry creation. Any suggestion to why this occurs?
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: Query adding Spaces after it is compiled

Post by Alexander Riedel »

You will have to be a little bit more specific. Extra spaces where precisely?
Alexander Riedel
SAPIEN Technologies, Inc.
This topic is 5 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.