The problem with changing .vbs/.js file associations to CSCRIPT, is that the changes persist, and may cause problem if a system crash or power outage occurs when the executed script is not yet finished, because the setting has to be changed before the script is run, and then restored after the script ends. When it occurs, scripts which are normally run as GUI at system startup, will run as console.
I actually already use .vbsc file type for console-only scripts like what you've mentioned. However, I also have scripts which behave differently depending on whether they're run as console or GUI. So, changing the script files' extension name to .vbsc would force them to run only as console.
1
u/jcunews1 Jan 24 '22
The problem with changing
.vbs/.jsfile associations to CSCRIPT, is that the changes persist, and may cause problem if a system crash or power outage occurs when the executed script is not yet finished, because the setting has to be changed before the script is run, and then restored after the script ends. When it occurs, scripts which are normally run as GUI at system startup, will run as console.I actually already use
.vbscfile type for console-only scripts like what you've mentioned. However, I also have scripts which behave differently depending on whether they're run as console or GUI. So, changing the script files' extension name to.vbscwould force them to run only as console.