View Full Version : How to hide command window?
Ronny
May 16th 07, 09:58 AM
I have an application (rxvt) which opens a Window when started (which
is not that unusual after all ;-)
The behaviour of this application can be customized via environment
variables. Now I would like to have on my desktop several icons,
each of which would, when clicked, launch this application, but
with a different set of environment variables.
To do this, I first created a CMD file corresponding to each of
the possible invocation patterns. Each CMD file looks roughly like
this:
rem Customize environment
set FOO=....
set BAR=....
rem Launch application
myappl.exe
Then I create desktop icons and associate them with each of these
CMD files.
This works well, but of course when I click on that icon, I see
a CMD window in addition to the window created by my application.
Is there a way how to hide this command window? Or is there a
better alternative to accomplish my goal?
Ronald
Uwe Sieber
May 16th 07, 10:35 AM
Ronny wrote:
> I have an application (rxvt) which opens a Window when started (which
> is not that unusual after all ;-)
>
> The behaviour of this application can be customized via environment
> variables. Now I would like to have on my desktop several icons,
> each of which would, when clicked, launch this application, but
> with a different set of environment variables.
>
> To do this, I first created a CMD file corresponding to each of
> the possible invocation patterns. Each CMD file looks roughly like
> this:
>
> rem Customize environment
> set FOO=....
> set BAR=....
> rem Launch application
> myappl.exe
>
> Then I create desktop icons and associate them with each of these
> CMD files.
>
> This works well, but of course when I click on that icon, I see
> a CMD window in addition to the window created by my application.
>
> Is there a way how to hide this command window? Or is there a
> better alternative to accomplish my goal?
http://www.uwe-sieber.de/files/hidrun.zip
If you start
c:\test\test.cmd
change to
c:\test\hidrun c:\test\test.cmd
assuming you put the hidrun.exe to c:\test.
Greetings from Germany
Uwe
Code-Curious Mom
May 16th 07, 01:31 PM
Try using a .js file to run the CMD file. Something like
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.run("C:\\foldername\\filename.cmd", 0, false);
Just substitute the path and filename you are using and save it as
filename.js. You can then make a shortcut to it for the desktop if desired.
Be sure to use double backslashes in the path as in above example.
(In case of wordwrap, there are 2 lines in the script, each one ends with a
semi-colon.)
For more details see
http://msdn2.microsoft.com/en-us/library/d5fk67ky.aspx
"Ronny" > wrote in message
oups.com...
>I have an application (rxvt) which opens a Window when started (which
> is not that unusual after all ;-)
>
> The behaviour of this application can be customized via environment
> variables. Now I would like to have on my desktop several icons,
> each of which would, when clicked, launch this application, but
> with a different set of environment variables.
>
> To do this, I first created a CMD file corresponding to each of
> the possible invocation patterns. Each CMD file looks roughly like
> this:
>
> rem Customize environment
> set FOO=....
> set BAR=....
> rem Launch application
> myappl.exe
>
> Then I create desktop icons and associate them with each of these
> CMD files.
>
> This works well, but of course when I click on that icon, I see
> a CMD window in addition to the window created by my application.
>
> Is there a way how to hide this command window? Or is there a
> better alternative to accomplish my goal?
>
> Ronald
>
Ronny
May 16th 07, 02:46 PM
On 16 Mai, 11:35, Uwe Sieber > wrote:
> > Is there a way how to hide this command window? Or is there a
> > better alternative to accomplish my goal?
>
> http://www.uwe-sieber.de/files/hidrun.zip
Thank you, this is great!
I wonder why Microsoft hasn't provided such an obviously useful
command in the first place...
Ronald
Ramesh, MS-MVP
May 16th 07, 02:46 PM
Hi Ronald,
Method 1: Using a VBScript to launch a .CMD or .BAT file invisible. Check these links:
http://groups.google.com/group/microsoft.public.windowsxp.general/msg/5e39f8a64270b620
http://groups.google.com/group/microsoft.public.windowsxp.general/msg/d281575031842fed
Method 2:
http://groups.google.com/group/microsoft.public.windowsxp.general/msg/647cc8688adbef90
Method 3:
To run the command script window minimized, see:
http://groups.google.com/group/microsoft.public.windowsxp.general/msg/5a750118becee275
--
Regards,
Ramesh Srinivasan, Microsoft MVP [Windows Shell/User]
Windows® Troubleshooting http://www.winhelponline.com
"Ronny" > wrote in message oups.com...
I have an application (rxvt) which opens a Window when started (which
is not that unusual after all ;-)
The behaviour of this application can be customized via environment
variables. Now I would like to have on my desktop several icons,
each of which would, when clicked, launch this application, but
with a different set of environment variables.
To do this, I first created a CMD file corresponding to each of
the possible invocation patterns. Each CMD file looks roughly like
this:
rem Customize environment
set FOO=....
set BAR=....
rem Launch application
myappl.exe
Then I create desktop icons and associate them with each of these
CMD files.
This works well, but of course when I click on that icon, I see
a CMD window in addition to the window created by my application.
Is there a way how to hide this command window? Or is there a
better alternative to accomplish my goal?
Ronald
Ronny
May 16th 07, 02:53 PM
On 16 Mai, 14:31, "Code-Curious Mom" > wrote:
> Try using a .js file to run the CMD file. Something like
>
> var WshShell = new ActiveXObject("WScript.Shell");
> WshShell.run("C:\\foldername\\filename.cmd", 0, false);
Thank you - I didn't even know that Windows natively supports Script
files
in JavaScript!
Ronald
Code-Curious Mom
May 16th 07, 03:20 PM
You're welcome. Be aware that if you use some sort of AV 'Script Blocking'
feature, this may trigger an alert due to the fact that it runs a program
(your CMD file).
"Ronny" > wrote in message
oups.com...
> On 16 Mai, 14:31, "Code-Curious Mom" > wrote:
>> Try using a .js file to run the CMD file. Something like
>>
>> var WshShell = new ActiveXObject("WScript.Shell");
>> WshShell.run("C:\\foldername\\filename.cmd", 0, false);
>
> Thank you - I didn't even know that Windows natively supports Script
> files
> in JavaScript!
>
> Ronald
>
vBulletin® v3.6.4, Copyright ©2000-2024, Jelsoft Enterprises Ltd.