Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Hide the command prompt windows


  • Please log in to reply

#16
timinator

timinator

    Member

  • Member
  • PipPip
  • 18 posts
That's better. Is this the same GetObject() call from the sample? It might help to post that portion of the code.
  • 0

Advertisements


#17
Michael

Michael

    Retired Staff

  • Topic Starter
  • Retired Staff
  • 1,869 posts
I have not changed it but here it the code any way.

Set objWMIService = GetObject("winmgmts:" _
  • 0

#18
timinator

timinator

    Member

  • Member
  • PipPip
  • 18 posts
That's only part of the statement; the "_" at the end continues the statement to the next line. Assuming that you haven't made any configuration changes to your computer, the only reason that I can think of for why that statement would fail is if the value of "strComputer" had been modified (or the part of the GetObject statement that uses it). Maybe someone more familar with WMI can help (the error appears to have been returned by WMI, which gets invoked as part of that particular GetObject call).

An alternative would be to use "WScript.Shell" to create the processes instead of using WMI, as was indicated in the JScript example given earlier.
  • 0

#19
JaceMan

JaceMan

    New Member

  • Member
  • Pip
  • 9 posts
First of all... I apologize for reviving an old dead thread, but I have been Googling for 3 hours now trying to resolve this very same issue. When I stumbled upon this forum, I KNEW I simply HAD to register as it looks like everyone here really knows their stuff!

What type of file should I save the script as, I am stilll learning all this stuf and not very good at it yet.


Apparently, you're better at this "stuff" than I am good sir! I say that because I failed in my attempt to get the advice to work. You were at least able to figure out what to modify in the sample script to achieve your desired results where as I was not. My vbs and js scripts seem to do "nothing." When I execute them, "nothing" seems to happen. That is to say, nothing launches and no errors are received.

Here are the contents of everything I have.

First... the bat file I wish to hide (so as to show you I'm not up to no good).

Thunderbird.bat (helps to launch multiple instances of Thunderbird so that I can use multiple profiles simultaneously)
@echo off
set MOZ_NO_REMOTE=1
start thunderbird.exe -p
set MOZ_NO_REMOTE=0

My attempts to hide the console window:

ThunderbirdLauncher.vbs
Const HIDDEN_WINDOW = 12

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
	& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objStartup = objWMIService.Get("Win32_ProcessStartup")

Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
Set objProcess = GetObject("winmgmts:root\cimv2:Win32_Process")
errReturn = objProcess.Create("cmd.exe /c C:\Program Files\Mozilla Thunderbird 2\Thunderbird.bat", null, objConfig, intProcessID)

and lastly...

ThunderbirdLauncher.js
var WindowStyle_Hidden = 0
var objShell = WScript.CreateObject("WScript.Shell")
var result = objShell.Run("cmd.exe /c C:\Program Files\Mozilla Thunderbird 2\Thunderbird.bat", WindowStyle_Hidden)

Thanks in advance for your help to those kind enough to reply. I apologize for my idiocy as this is the first time I've ever attached the extensions .vbs or .js to a file (i.e. I'm very, VERY green), although I have used batch files quite a bit in the past. As a side note, I've been reading through the forum a bit before registering, and I think I might call this place home. I'm no genius, but I do have a little I believe I can add here and there to make me valuable. If nothing else, I'll at least do my best to contribute.

Thanks again!

- Jace
  • 0

#20
fh.hillsboro

fh.hillsboro

    New Member

  • Member
  • Pip
  • 1 posts
OK, I am using the referenced vbs script to run my program reduced and hidden, without the annoying command window and it works super well. The next annoying issue is that when the script runs, it grabs the cursor and moves it out of the window I am typing or navigating in. Dumb. Is there any way to stop this stupid behavior?
  • 0

#21
soul_shot_fire

soul_shot_fire

    New Member

  • Member
  • Pip
  • 1 posts

hmm
and what are you exactly trying to create? a virus?

such things should not be encouraged on public forums...

ur r sir r stupid i used this code for minecraft server help
an tyvm for this stuff like this can b used for many things y not put sumthing out there that ppl can look up instead for wiating for sumone to reply bak to them that could take up to 1-3 weeks( well) parts of this code ....

Edited by soul_shot_fire, 04 September 2011 - 04:01 PM.

  • 0

#22
Firzok

Firzok

    New Member

  • Member
  • Pip
  • 1 posts
Hi guys i am kind of new to this stuff,I also wanted to hide one of my bat file and this post was so helpful thank you all of you

I have a bat file that copies some files from one directory to another it was working fine when it was not hidden but now it when i run it hidden it copies hose files to "C:/" please help me guys i want to copy those files where my bat file is.

Any reply would be so helpfull.
  • 0

#23
Ztruker

Ztruker

    Member 5k

  • Technician
  • 7,065 posts
Post the bat file so we can look at it.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP