Skip to content

actions do nothing on Windows — what is correct syntax to open a file? #59

@dominatos

Description

@dominatos

Problem
On Windows, clicking menu items that use shell= does nothing. The menu renders correctly but no action is triggered.

Environment
OS: Windows11
Platform string returned by crossbar.platform(): windows

Test plugin
I wrote a debug plugin trying every possible syntax I could think of:

lua-- test-open.1m.lua
local raw_platform = crossbar.platform()
local platform = string.lower(raw_platform or "")
local TEST_FILE = 'C:\\Users\\user\\folder1\\folder2\\file.md'

print('🧪 Test open')
print('---')
print('Default (cmd start) | shell=cmd.exe param1=/c param2=start param3="" param4="' .. TEST_FILE .. '" terminal=false')
print('---')
print('explorer.exe | shell=explorer.exe param1="' .. TEST_FILE .. '" terminal=false')
print('---')
print('cmd start no-title | shell=cmd.exe param1=/c param2=start param3="' .. TEST_FILE .. '" terminal=false')
print('---')
print('powershell Start-Process | shell=powershell.exe param1=-NoProfile param2=-Command param3="Start-Process -FilePath \\"' .. TEST_FILE .. '\\"" terminal=false')
print('---')
print('powershell Invoke-Item | shell=powershell.exe param1=-NoProfile param2=-Command param3="Invoke-Item \\"' .. TEST_FILE .. '\\"" terminal=false')
print('---')
print('rundll32 | shell=rundll32.exe param1=url.dll,FileProtocolHandler param2="' .. TEST_FILE .. '" terminal=false')
print('---')
print('simple start | shell=cmd.exe param1=/c param2=start param3=' .. TEST_FILE .. ' terminal=false')
print('---')
print('Open file terminal=true | shell=cmd.exe param1=/c param2=start param3="" param4="' .. TEST_FILE .. '" terminal=true')
print('---')
print('Open via bat | shell=C:/Users/fedorenko/crossbar_open.bat param1="' .. TEST_FILE .. '" terminal=false')
print('---')
print('platform: [' .. tostring(raw_platform) .. '] | color=gray')
print('---')
print('Path: ' .. TEST_FILE .. ' | color=gray')

Result
All items render in the menu but none of them open the file when clicked. No error, no action, nothing happens.

Question
What is the correct syntax to open a file with its default application on Windows from a Lua plugin? Is there a working example?

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