+3 votes
78 views

I just started learning Odoo, When I read their docs they said there is a command called odoo-bin, but when I run the command in PowerShell, it gives me an error:

At line:1 char:54
+ ... python.exe' 'C:\Program Files (x86)\Odoo 12.0\server\odoo-bin' scaffo ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token ''C:\Program Files (x86)\Odoo 12.0\server\odoo-bin'' in expression or statement.
At line:1 char:105
+ ... ' 'C:\Program Files (x86)\Odoo 12.0\server\odoo-bin' scaffold custom_ ...
+                                                          ~~~~~~~~
Unexpected token 'scaffold' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

What is the meaning of that? what did I miss? Below here is how I run the command:

"c:\Program Files (x86)\Odoo 12.0\python\python.exe" "C:\Program Files (x86)\Odoo 12.0\server\odoo-bin" scaffold custom_salesorder "C:\Program Files (x86)\Odoo 12.0\server\odoo\addons"

The python.exe location is right, the odoo-bin file exists in that folder, it still give me an error. I use odoo 12.

in Server by (10.5k points) | 78 views

1 Answer

+3 votes
Best answer

By default PowerShell echoes strings instead of executing them. You need the call operator(&) to tell PowerShell to execute the given string as a command.

Demonstration:

PS C:\> "C:\Windows\System32\PING.EXE"
C:\Windows\System32\PING.EXE
PS C:\> "C:\Windows\System32\PING.EXE" "127.0.0.1"
At line:1 char:32
+ "C:\Windows\System32\PING.EXE" "127.0.0.1"
+                                ~~~~~~~~~~~
Unexpected token '"127.0.0.1"' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : UnexpectedToken

PS C:\> & "C:\Windows\System32\PING.EXE" "127.0.0.1"

Pinging 127.0.0.1 with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

Ping statistics for 127.0.0.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

Change your commandline to this, and the problem will disappear:

& "c:\Program Files (x86)\Odoo 12.0\python\python.exe" "C:\Program Files (x86)\Odoo 12.0\server\odoo-bin" scaffold custom_salesorder "C:\Program Files (x86)\Odoo 12.0\server\odoo\addons"
by (4.6k points)
selected by
205 questions
180 answers
37 comments
221,400 users