RIAS
asked on
Change case of fieldname in the sys environmental variables
ASKER
Hi Ste5an,
Thanks. But, there is an application which needs the 'Path' to be set to 'path'. A powershell script should be ideally able to fix it.
Thanks. But, there is an application which needs the 'Path' to be set to 'path'. A powershell script should be ideally able to fix it.
I can't see any reason for the need to do that, but if you highlight the variable, then click on "Edit", then click on "Edit text", you can change the variable's case or name.
ASKER
Thanks. But its a requirement of someother app on the machine. We need a script to run on a silent install so cannot do any editting manually.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
First of all, thanks a lot for providing help.
Yes, I agree that app is very very old and has a requirement for the path to be in lower case. Even if it modifes the path to lower case for a session its great. Also the app is not stand alone as in .exe to add to complexity is a library used in a project ( misery). But, will try your script and hen open the project seperately.
Will be right back
Yes, I agree that app is very very old and has a requirement for the path to be in lower case. Even if it modifes the path to lower case for a session its great. Also the app is not stand alone as in .exe to add to complexity is a library used in a project ( misery). But, will try your script and hen open the project seperately.
Will be right back
ASKER
So you suggest there cannot be a poweshell script? The requirement is for a developer desktop so it does not matter if the path is permanently changed to lower case as it is used for that developer to run those apps.
ASKER
If there is a powershell script it will be like the solution is achieved.
Path is a special variable; I can't tell if it's possible to permanently force it to lowercase.
If it's for a developer, and the developer in question is using only command line tools (as opposed to starting them from Explorer), he can just open a cmd prompt using a shortcut with this target:
Or for PowerShell:
Or a brute-force alternative: have you tried opening (a copy of) the library in a hex editor, searching for "path", and replacing it with "Path"?
If it's for a developer, and the developer in question is using only command line tools (as opposed to starting them from Explorer), he can just open a cmd prompt using a shortcut with this target:
cmd.exe /v:on /k "set p=!Path!&set Path=&set path=!p!"
Then just do anything from inside this prompt.Or for PowerShell:
powershell.exe -NoExit -Command "$p = $env:Path; Remove-Item env:Path; $null = New-Item env:\path -Value $p"
Or a brute-force alternative: have you tried opening (a copy of) the library in a hex editor, searching for "path", and replacing it with "Path"?
ASKER
Or a brute-force alternative: have you tried opening (a copy of) the library in a hex editor, searching for "path", and replacing it with "Path"?:
ahh no, will try. Is there a powershell command to do so?
ahh no, will try. Is there a powershell command to do so?
ASKER
The whole thing here oDbA is to do silent install with scripts with no manual intervention. So Iam requesting for scripts. Thanks a lot.
ASKER
The library we cannot open as its embedded. But will check
[..] is to do silent install with scripts with no manual intervention. [..]For a developer system? Makes no sense to me..
ASKER
Its for many developer desktops remotely based onsite
ASKER
Hi,
Checked the library cannot be accessed. So only way is to do it by script. Instead of command prompt is there a powershell command to do? It need not be permamently changed but just for that session is fine ( till the user logs out).
Checked the library cannot be accessed. So only way is to do it by script. Instead of command prompt is there a powershell command to do? It need not be permamently changed but just for that session is fine ( till the user logs out).
ASKER
Hi oDba,
The env variables I have to set are using admin rights for setting the system and local environment variables. None of the scripts above are making the change to the case.
Any suggestions?
Thanks
The env variables I have to set are using admin rights for setting the system and local environment variables. None of the scripts above are making the change to the case.
Any suggestions?
Thanks
CAVEAT: Untested, may brick your machine.
I think the only way is to change the name in the registry.
It for sure requires then a reboot. Maybe you cannot change it in an active hive, so you need to test using a live stick too. Especially as you need to delete the key and the recreate it with your desired casing.
I think the only way is to change the name in the registry.
It for sure requires then a reboot. Maybe you cannot change it in an active hive, so you need to test using a live stick too. Especially as you need to delete the key and the recreate it with your desired casing.
ASKER
Yes Ste5an, This solution is we are aware but we cannot reboot this is the limitation. So was looking for a powershell script which does it.
Well, I guess you're back again to change the software to a Windows conform behaviour by removing the bug in it.
ASKER
Its a Java lib known as Ant
Take the source and fix it. But I'm not sure, whether it is really an library issue. Those libriares are normally pretty stable. And such an error would have been observed already by many others. Cause the env var behaviorr is the same since XP.
But on the other hand, what is your reasoning behind that exercise? Why not do the builds on WSL2`?
But on the other hand, what is your reasoning behind that exercise? Why not do the builds on WSL2`?
ASKER
Ste5an its an old system. We just have to work around it. Till day everyone is doing a manual edit. But, needed a script to do so.
Then rebuild the old system. Your trying to fix the wrong problem then.
ASKER
Yes agree but its planned next year. Till then :>
The scripts/shortcuts above are not meant for installation or a permanent (one-time) configuration.
They are meant for "every day use", that is, they take the current Path environment variable and change the case of the variable name to lowercase for the process running the script (and all of its child processes).
Since it's Java, it's all about running command lines anyway, so use one of the shortcuts I posted above to start a cmd or PS shell, and run all the build commands from there.
Maybe this is related:
SYSTEM VARIABLES lower case ??? Ant issue
https://social.msdn.microsoft.com/Forums/vstudio/en-US/031707fc-b95d-407c-aadf-5dc1bca69c94/system-variables-lower-case-ant-issue?forum=tfsbuild
They are meant for "every day use", that is, they take the current Path environment variable and change the case of the variable name to lowercase for the process running the script (and all of its child processes).
Since it's Java, it's all about running command lines anyway, so use one of the shortcuts I posted above to start a cmd or PS shell, and run all the build commands from there.
Maybe this is related:
SYSTEM VARIABLES lower case ??? Ant issue
https://social.msdn.microsoft.com/Forums/vstudio/en-US/031707fc-b95d-407c-aadf-5dc1bca69c94/system-variables-lower-case-ant-issue?forum=tfsbuild
ASKER
The way it works is that, the build is from a visual studio with around 10 projects and 25 libs. So building from a command prompt is not possible.
ASKER
I apologize but there are very few options we are left with and the script to change the case of the env variable is the only option left.
Ant is a build tool, I would assume it is somewhere triggerd. Look into the build macros...
And then the quesion is why is the system path of relevance now? Dependencies should be specifed explicitly and specifiyng the complete path for tools should be that hard either. Does MSBuild not work for Java projects?
And then the quesion is why is the system path of relevance now? Dependencies should be specifed explicitly and specifiyng the complete path for tools should be that hard either. Does MSBuild not work for Java projects?
ASKER
Its not a Java project. Its a vb project with all types of lib.There where the complexity lies.
Your trying to make a legacy system run which currently breaks due to a bug. Thus the correct options are fixe the bug or rebuild the legacy system using VM's.
When these are no options, then try the reg hack. Cause then the annoying fact of a reboot does simply not matter as it still saves you money as you don't need to advance the next years migration.
And last but not least, I would consider rebuilding the built system for this solution, so that it work.
When these are no options, then try the reg hack. Cause then the annoying fact of a reboot does simply not matter as it still saves you money as you don't need to advance the next years migration.
And last but not least, I would consider rebuilding the built system for this solution, so that it work.
ASKER
Thanks Ste5an. This is a complex task but, really appreciate your inputs.
VB `? Why does it use ant, interessting.. Then I would just setup the solution from scratch, so that it works.
10 projects and 25 lib sounds more than it probably really is..
p.s. I did some jobs like this in the past for .NET and Delphi systems. The most complex part was to handle the code repositories and the test frameworks. The actual resetup of the solution and build of such things is a diligent but routine piece of work.
10 projects and 25 lib sounds more than it probably really is..
p.s. I did some jobs like this in the past for .NET and Delphi systems. The most complex part was to handle the code repositories and the test frameworks. The actual resetup of the solution and build of such things is a diligent but routine piece of work.
ASKER
haha, this is what it is Ste5an , we are dealing with it till next year and then it rebuilds :> There is lot of stuff in it which we do not need and there are processes to do every bit.
Then start Visual Studio in the way described; again: the changed environment variables will be inherited by all child processes.
The way it works is that, the build is from a visual studio with around 10 projects and 25 libs. So building from a command prompt is not possible.
In addition to @oBdA: Take a look at the special VS prompts. This basically what they do.
ASKER
Sure experts will all of the above tomorrow at desk. Really appreciate your valuable inputs. Thanks a ton.
ASKER
Thanks a lot all! oDbA, your solution was accepted. Still, a few more tests are to be done but, the concept worked and we are testing it. Really appreciate your help and efforts. This was an impossible task but, looks like we got a good workaround. oDbA you are truly a genius. I will post more comments as testing progresses.
If your using a case-sensitive consumer, then you need to normalize the casing there.
Normal environment variables are stored in the registry, thus you can edit their name their. But I'm not sure for such essential ones like Path. You may give it a try.
p.s. your requirement is missing.