Page 1 of 1

Query adding Spaces after it is compiled

Posted: Wed Aug 29, 2018 8:49 am
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

Re: Query adding Spaces after it is compiled

Posted: Thu Aug 30, 2018 8:39 am
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( ' ', '')

Re: Query adding Spaces after it is compiled

Posted: Fri Aug 31, 2018 12:25 am
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.

Re: Query adding Spaces after it is compiled

Posted: Fri Aug 31, 2018 6:38 am
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?

Re: Query adding Spaces after it is compiled

Posted: Fri Aug 31, 2018 1:11 pm
by Alexander Riedel
You will have to be a little bit more specific. Extra spaces where precisely?