ClickOnce application does not start through Process.Start(“x.abc”) with *.abc associated to the ClickOnce application

后端 未结 4 931
心在旅途
心在旅途 2020-12-30 03:02

I have successfully developed and deployed a ClickOnce application which registers an associated file extension, for instance *.abc. When I click on a file name

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 03:24

    I've come up with a .BAT based solution, which is easy to implement. Say that you want to launch the ClickOnce application associated with *.abc files, then you simply put a file with the same name, but with the *.bat extension in the same folder, and then execute the batch file instead. Here is the batch script:

    if exist "%windir%\sysnative\cmd.exe" goto :mode64bit
    
    rem For a file named "C:\foo\xyz.bat", this will generate the corresponding
    rem "C:\foo\xyz.abc" file, built as the concatenation of the drive (%~d0),
    rem the folder (%~p0) and the file name (%~n0), plus ".abc":
    
    "%~d0%~p0%~n0.abc"
    goto :end
    
    :mode64bit
    
    rem When running in a 32-bit emulation environment on a real 64-bit system,
    rem start the 64-bit version of CMD.EXE, and make if start the ".abc" file
    rem for us:
    
    C:\Windows\sysnative\cmd.exe /c "%~d0%~p0%~n0.xgen"
    
    :end
    

    This could be implemented directly in the caller of the *.abc files, but sometimes a batch file helps in the transition...

提交回复
热议问题