07-24-2023, 04:40 AM
I made a HTA app that sets virtual space to custom instead of automatic, but I came across with following problem, when I run the function it says that computername is not defined, however if you are running it in CMD everything works just fine.
I assume in HTA you need to use some special characters for symbols like %,=, etc?
This is my function:
```
function enablevirtualspace(){
var wshShell = new ActiveXObject("WScript.Shell");
var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%");
var path = "wmic computersystem where name="%computername%" set AutomaticManagedPagefile=false";
wshShell.run(path,1,false);
}
```
I assume in HTA you need to use some special characters for symbols like %,=, etc?
This is my function:
```
function enablevirtualspace(){
var wshShell = new ActiveXObject("WScript.Shell");
var sComputerName = wshShell.ExpandEnvironmentStrings("%COMPUTERNAME%");
var path = "wmic computersystem where name="%computername%" set AutomaticManagedPagefile=false";
wshShell.run(path,1,false);
}
```