我有一种情况,我正在使用64位版本的Visual Studio Code编写/调试Powershell脚本。但是,由于Powershell脚本在做什么,它需要在Powershell的32位版本中运行。它使用一些库来访问MS Access文件,因此我还没有找到一种使事情在Powershell x64中工作的方法。
如果VS Code本身以64位运行,是否可以告诉VS Code运行32位版本的Powershell?例如,是否可以修改launch.json文件以指定powershell本身的路径?
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "PowerShell",
"request": "launch",
"name": "PowerShell Launch Current File",
"script": "${file}",
"args": [],
"cwd": "${file}"
},
...
]
}
最佳答案
假设您已安装PowerShell extension,则应该可以将“VS代码设置”中的powershell.powerShellExePath
设置修改为"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"
。
我相信您也可以设置"powershell.useX86Host": true
。这是在PowerShell扩展v0.5.0中引入的;我不确定我怎么会错过它的包容性!
但是,安装64位MS Access组件并仅使用64位版本可能更容易或更佳。
Microsoft Access Database Engine 2010 Redistributable
Microsoft Access 2013 Runtime
Microsoft Access Database Engine 2016 Redistributable
我不知道为什么2013版本会有不同的名称,但据我所知,这些是不同版本的相同组件。