You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature-requestRequest for new features or functionalityterminalGeneral terminal issues that don't fall under another labelwindowsVS Code on Windows issues
The terminal opened by default is the 32bit terminal for cmd.exe or Powershell.exe
On 64 Bit OS Code should be interacting with the sysnative variants.
There is a sort of work around by adding the sysnative path like below, but this should be handled by default. The PowerShell Extension does this for it's terminal session.
Using 32bit breaks a lot of modules and also causes issues when testing your code. PSReadLine is an example of one Module that breaks. One example that could cause problems in your code, is if you are testing something with parts of the registry, the 32 bit console is going to give you bad results since it will be giving you results for the wow3264Node instead.
Reacted by Ignat Ignatov, Maxim Pashuk, Saran Tanpituckpong ✔️, haz-q and Kaiyuan Liu
Right now the default is %COMSPEC% which defines the default terminal for the environment, if powershell.exe or cmd.exe is used, it's grabbed off the path. So we're leaving it up to powershell and windows which bitness is selected.
Daniel Imms (@Tyriar) On Windows, this is not going to be the desired way for this to function. Is it planned to be changed?
%SystemRoot%\sysnative does not actually exist, it functions as a folder redirect for 64bit systems. So if a 64bit system uses %SystemRoot%\sysnative it is reditected to %SystemRoot%\System32.
%SystemRoot%\SysWOW64 is actually what is being executed when running in a 32bit process on a 64bit machine. A 32 process targeting %SystemRoot%\System32 is redirected to %SystemRoot%\SysWOW64 and is the root of the problems. For a 32 bit process to actually run %SystemRoot%\System32, it has to use %SystemRoot%\Sysnative redirect. There are countless issues this will cause in the long run, any many of them may be silent to the end user. They may not find out until their code gets closer to production.
Here is a shorter diagram:
*32Bit on 64Bit >> %SystemRoot%\System32\ >> %SystemRoot%\SysWOW64*
*32Bit on 32Bit >> %SystemRoot%\System32\ >> %SystemRoot%\System32*
*32Bit on 64Bit >> %SystemRoot%\Sysnative\ >> %SystemRoot%\System32*
Reacted by Felix Becker, cwclam-diagcor and Tuochen Lyu
So you would suggest that getWindowsShell, which powers both internal and external terminals, becomes "%SystemRoot%\sysnative\cmd.exe" or something similar? After the environment variable is resolved, querying c:\Windows\sysnative\cmd.exe should work?
Then maybe add a note about %SystemRoot%\sysnative in the Windows shell config descriptions? I'd prefer to avoid messing with the paths that users enter in their settings.json.
Daniel Imms (@Tyriar) I am not very familiar with TS or JS, so I can't show you exactly how it would function in getWindowsShell. I mainly interact with PowerShell and a tiny bit of C#.
You would need to check the OS Arch and Process Arch, or since code doesn't have a 64 bit client, just check OS Arch, and if 64bit use sysnative. You can test this out by opening both %SystemRoot%\System32\cmd.exe and %SystemRoot%\syswow64\cmd.exe to see how these act.
Sysnative does not exist for a session that has normal access to %SystemRoot%\System32\. So 64bit Process on 64bit OS and 32bit Process on 32bit OS can't use sysnative. Sysnative is just for use for 32 bit processes on a 64 bit OS.
If you use C:\Windows\syswow64\cmd.exe and run dir %SystemRoot%\sysnative\ it will return the contents of a C:\windows\sysnative\ directory even though it really doesn't exist. It is actually returning the contents of C:\windows\system32\.
Then if you use C:\windows\system32\cmd.exe and run dir %SystemRoot%\sysnative\ you get a File Not Found error.
I just wanted to bring up that this is a bigger issue on Windows than most realize. I have been heavily burned by this in the past and it cost me months of my time and a lot of gray hairs. I just wanted to try to help others avoid the same issues I have gone through in the past. Sometimes you don't realize an issue is even present until after the damage is done when dealing with Windows 32 bit redirections.
Even just running normal command line tools it is executing the 32bit versions instead of the 64 bit versions which could have some undesired results. Just look at reg.exe for example, most people don't use it's /reg:32 or /reg:64 flags, so it might not target the key they think it is targeting.
Brandon Padgett (@gerane) do you know how far back in Windows support for sysnative goes? Would it be reasonable to just set the default to c:\\Windows\\sysnative\\cmd.exe or would that fail on Windows 7 or something?
Daniel Imms (@Tyriar) sysnative is only present on 64 bit Windows. So you would have to determine what platform you are running on. Sysnative won't exist on 32bit Windows.
I think the comment should help those who are going to change it. Would it be beneficial to include a link to information about it? I know it is a confusing topic, and I even regularly see people offering advice on stack overflow or other forums that is incorrect. They often mix the paths up etc.
I'd prefer not to include a link to it, help is always available from our website if needed. After a few months to think about this, while it's tempting to hard code either sysnative on 64bit systems or system32 on 32-bit systems, that would break the %COMSPEC% feature which has been explicitly requested in the past. I think the comment is a good compromise and I haven't seen too many issues come in to do with bitness since so I think I'll close this one off.
Thanks Tyriar for your kind reply. Really appreciate, but I dont see the folder "sysnative" in my windows folder, loioking forward to your further help, thanks.
feature-requestRequest for new features or functionalityterminalGeneral terminal issues that don't fall under another labelwindowsVS Code on Windows issues
Activity
[-]Use 64 Bit Terminals on 64 Bit OSes on WIndows[/-][+]Use 64 Bit Terminals on 64 WIndows[/+]Tyriar commentedon Jun 1, 2016
Brandon Padgett (@gerane) see my comments on #6684 (comment) about my experiences with 64-bit powershell, back when powershell was the default.
Right now the default is
%COMSPEC%which defines the default terminal for the environment, if powershell.exe or cmd.exe is used, it's grabbed off the path. So we're leaving it up to powershell and windows which bitness is selected.gerane commentedon Jun 1, 2016
Daniel Imms (@Tyriar) On Windows, this is not going to be the desired way for this to function. Is it planned to be changed?
%SystemRoot%\sysnative does not actually exist, it functions as a folder redirect for 64bit systems. So if a 64bit system uses %SystemRoot%\sysnative it is reditected to %SystemRoot%\System32.
%SystemRoot%\SysWOW64 is actually what is being executed when running in a 32bit process on a 64bit machine. A 32 process targeting %SystemRoot%\System32 is redirected to %SystemRoot%\SysWOW64 and is the root of the problems. For a 32 bit process to actually run %SystemRoot%\System32, it has to use %SystemRoot%\Sysnative redirect. There are countless issues this will cause in the long run, any many of them may be silent to the end user. They may not find out until their code gets closer to production.
Here is a shorter diagram:
*32Bit on 64Bit >> %SystemRoot%\System32\ >> %SystemRoot%\SysWOW64*
*32Bit on 32Bit >> %SystemRoot%\System32\ >> %SystemRoot%\System32*
*32Bit on 64Bit >> %SystemRoot%\Sysnative\ >> %SystemRoot%\System32*
Tyriar commentedon Jun 1, 2016
Thanks for the info Brandon Padgett (@gerane), really useful!
So you would suggest that getWindowsShell, which powers both internal and external terminals, becomes
"%SystemRoot%\sysnative\cmd.exe"or something similar? After the environment variable is resolved, queryingc:\Windows\sysnative\cmd.exeshould work?Then maybe add a note about
%SystemRoot%\sysnativein the Windows shell config descriptions? I'd prefer to avoid messing with the paths that users enter in their settings.json.gerane commentedon Jun 1, 2016
Daniel Imms (@Tyriar) I am not very familiar with TS or JS, so I can't show you exactly how it would function in getWindowsShell. I mainly interact with PowerShell and a tiny bit of C#.
You would need to check the OS Arch and Process Arch, or since code doesn't have a 64 bit client, just check OS Arch, and if 64bit use sysnative. You can test this out by opening both
%SystemRoot%\System32\cmd.exeand%SystemRoot%\syswow64\cmd.exeto see how these act.Sysnative does not exist for a session that has normal access to
%SystemRoot%\System32\. So 64bit Process on 64bit OS and 32bit Process on 32bit OS can't use sysnative. Sysnative is just for use for 32 bit processes on a 64 bit OS.If you use
C:\Windows\syswow64\cmd.exeand rundir %SystemRoot%\sysnative\it will return the contents of aC:\windows\sysnative\directory even though it really doesn't exist. It is actually returning the contents ofC:\windows\system32\.Then if you use
C:\windows\system32\cmd.exeand rundir %SystemRoot%\sysnative\you get a File Not Found error.I just wanted to bring up that this is a bigger issue on Windows than most realize. I have been heavily burned by this in the past and it cost me months of my time and a lot of gray hairs. I just wanted to try to help others avoid the same issues I have gone through in the past. Sometimes you don't realize an issue is even present until after the damage is done when dealing with Windows 32 bit redirections.
Even just running normal command line tools it is executing the 32bit versions instead of the 64 bit versions which could have some undesired results. Just look at reg.exe for example, most people don't use it's /reg:32 or /reg:64 flags, so it might not target the key they think it is targeting.
Tyriar commentedon Jun 1, 2016
Ok, well I guess resolving this will involve:
%COMSPEC%as the default for internal and external terminalsTyriar commentedon Jul 15, 2016
Brandon Padgett (@gerane) do you know how far back in Windows support for sysnative goes? Would it be reasonable to just set the default to
c:\\Windows\\sysnative\\cmd.exeor would that fail on Windows 7 or something?Add note about Windows\sysnative in terminal settings
Tyriar commentedon Jul 15, 2016
Just added this to settings:
gerane commentedon Sep 19, 2016
Daniel Imms (@Tyriar) sysnative is only present on 64 bit Windows. So you would have to determine what platform you are running on. Sysnative won't exist on 32bit Windows.
I think the comment should help those who are going to change it. Would it be beneficial to include a link to information about it? I know it is a confusing topic, and I even regularly see people offering advice on stack overflow or other forums that is incorrect. They often mix the paths up etc.
Tyriar commentedon Sep 19, 2016
I'd prefer not to include a link to it, help is always available from our website if needed. After a few months to think about this, while it's tempting to hard code either sysnative on 64bit systems or system32 on 32-bit systems, that would break the
%COMSPEC%feature which has been explicitly requested in the past. I think the comment is a good compromise and I haven't seen too many issues come in to do with bitness since so I think I'll close this one off.shabbi75 commentedon Jan 27, 2017
Hi,
I am facing the same problem, What is the solution for this? thanks.
Tyriar commentedon Jan 27, 2017
shabbi75 the recommended config is here https://code.visualstudio.com/docs/editor/integrated-terminal#_configuration
shabbi75 commentedon Jan 27, 2017
Thanks Tyriar for your kind reply. Really appreciate, but I dont see the folder "sysnative" in my windows folder, loioking forward to your further help, thanks.
Tyriar commentedon Jan 27, 2017
It's a special folder that you can't see in windows explorer, put it in your config and it should work on a 64-bit machine.
shabbi75 commentedon Jan 27, 2017
Thanks, could you please provide this information in detail that which config I need to change, thanks. I dont have any information for that, thanks.
Tyriar commentedon Jan 27, 2017
For 64-bit powershell, add this to your settings.json file (File > Preferences > Settings):
shabbi75 commentedon Jan 28, 2017
Sorry, am bothering you a lot.
I have searched my system and found below files, could you please advise me which one I need to change, thanks.
Best Regards,
Shabber Abbas Rizvi
Tyriar commentedon Jan 28, 2017
You open it from within the applications file menu.
shabbi75 commentedon Jan 29, 2017
I don't see this please
Tyriar commentedon Jan 29, 2017
That is visual studio, not visual studio code. Different product.