Skip to main content
The 2024 Developer Survey results are live! See the results
added 542 characters in body
Source Link
Bob
  • 62k
  • 25
  • 199
  • 222

If you want the reasoning behind it, the Start in is explicitly ignored when elevation is performed (only on binaries that are part of Windows itself) to protect against a potential security vulnerability.

The basic idea is that potentially-malicious DLLs located in the working directory might be controlled by a user other than the current admin, and can then be loaded with high privileges. To prevent this, UAC will reset the working directory. Because shortcuts' "Start in" is set before elevation occurs, this gets reset during elevation. In an ideal world, this protection would apply to all elevations, but it only applies to built-in Windows binaries because it breaks some third-party programs that expect the working directory to be preserved.

The other answers bypass this by telling the elevated cmd to change its working directory after elevation occurs, via the /k argument.

If you want the reasoning behind it, the Start in is explicitly ignored when elevation is performed (only on binaries that are part of Windows itself) to protect against a potential security vulnerability. The other answers bypass this by telling the elevated cmd to change its working directory after elevation occurs, via the /k argument.

If you want the reasoning behind it, the Start in is explicitly ignored when elevation is performed (only on binaries that are part of Windows itself) to protect against a potential security vulnerability.

The basic idea is that potentially-malicious DLLs located in the working directory might be controlled by a user other than the current admin, and can then be loaded with high privileges. To prevent this, UAC will reset the working directory. Because shortcuts' "Start in" is set before elevation occurs, this gets reset during elevation. In an ideal world, this protection would apply to all elevations, but it only applies to built-in Windows binaries because it breaks some third-party programs that expect the working directory to be preserved.

The other answers bypass this by telling the elevated cmd to change its working directory after elevation occurs, via the /k argument.

Source Link
Bob
  • 62k
  • 25
  • 199
  • 222

If you want the reasoning behind it, the Start in is explicitly ignored when elevation is performed (only on binaries that are part of Windows itself) to protect against a potential security vulnerability. The other answers bypass this by telling the elevated cmd to change its working directory after elevation occurs, via the /k argument.