is there a way to change the cmd title? I wrote a vbs program. But the dos title is bad.
The name ist c:\windows\system32\cscript.exe I try it with:
title the_name and title ="name"
But both doesn't works.
Thanks for help.
is there a way to change the cmd title? I wrote a vbs program. But the dos title is bad.
The name ist c:\windows\system32\cscript.exe I try it with:
title the_name and title ="name"
But both doesn't works.
Thanks for help.
Unfortunately you cannot do that from within the script using any of the WSH objects.
The only way to do it is to launch the script via an intermediary (a .bat using the TITLE command or another script using a %comspec% argument).
@AlexK The link you point to actually shows how you CAN change the title of the command window so I'm not sure why that doesn't work as a solution to Matthias's problem.
@Matthias - since you are already using cscript you have a couple of options:
var x = new ActiveXObject("WScript.shell");
for (var i=0; i < 5; i++) {
x.run('cmd title your title ' + i + '| cscript.exe "params"');
}
or just make the parent script execute one child script but prompt for the title before it runs the cscript command like so:
var x = new ActiveXObject("WScript.shell");
x.run('cmd title your title ' +
WScript.StdIn.ReadLine() +
'| cscript.exe "script path and params"');
c:\>start "your title" cscript script_path.vbs
Check out the IEUnit project, specifically the Win32Dom activex object. It's a good project to start from because it solves the "how to create a c# activex object" and "how to call the win32 api" questions you might have for this option. And it already has the findWindow portion finsihed for you.
http://code.google.com/p/ieunit/source/browse/#svn%2Ftrunk%2Ftool%2FWin32Dom
Do you need to change it in the code or do you just want it to look a little nicer? You could possibly do it by creating a shortcut to your script and then changing the name of the shortcut (in the properties of the shortcut, change to the General
tab and change the name there).