• 0

Hide bat file windows!


Question

Hello!

I need a program that will stop bat (and cmd) files that I make from showing up.

I have been using a premade one for a while now, but I need to add features... like being able to open multiple batch files at once.

This is the premade one: http://www.mediafire.com/?8d0qsyqduzu

Can someone give me the source for that? Or can someone give me a link to a different one or tell me how I can code my own?

Thanks in advance,

Panarchy

Link to comment
Share on other sites

21 answers to this question

Recommended Posts

  • 0

I don't think there's a way to "hide" the launch of a command shell script, because it requires the launch of either PowerShell or CMD (which will show up).

Even if you wrote a VB program that ran all your commands for you, using commands like del, dir, etc will still cause CMD to show up because they run in the command line.

You could use @echo off to make it just "blink" (ie. reduce the amount of output.)

Link to comment
Share on other sites

  • 0

You can launch a batch file with a hidden window quite easily. If you want something simple made, e.g. if you want a program that will launch a list of batch files listed in a text file, I can do that for you. Either PM me or post what you want here.

Link to comment
Share on other sites

  • 0
Hello!

I need a program that will stop bat (and cmd) files that I make from showing up.

I have been using a premade one for a while now, but I need to add features... like being able to open multiple batch files at once.

This is the premade one: http://www.mediafire.com/?8d0qsyqduzu

Can someone give me the source for that? Or can someone give me a link to a different one or tell me how I can code my own?

Thanks in advance,

Panarchy

You can do what you want without any Third Party Apps, using a simple VBS script.

Here is an example VBS script I made.

1:\ Reads from a text file called BatchList.txt

2:\ Processes each line in the text file as a Varible

3:\ Runs the Batch or Cmd without showing the Cmd Promt Window

4:\ Creates a text file in the Windir and Named ReportBatch.log

5:\ Then list if the Cmd Ran or was Missing

6:\ Runs ReportBatch.log and when you close it ask if you want to keep it or delete it

Example Contents of BatchList.txt

Test1.cmd

C:\Test\Test2.cmd

D:\Download\Test2.cmd

Test3.cmd

C:\Scripts\Templates\Test4

Example Test1.cmd

I only made One cmd to test and had it direct it output to a text file to confirm it ran.

@echo off

Set T=%Time%

Set D=%Date%

Echo ^<-------------------------------------------^> >>Test1.log

Echo Batch Run Time -^> %D% - %T% >>Test1.log

Echo Confirmed Batch File Ran>>Test1.log

Echo ^<-------------------------------------------^> >>Test1.log

Example Contents of ReportBatch.log

I only made One cmd to test and had it direct it output to a text file to confirm it ran.

?? Confirm Cmd Test1.cmd

?? Date Time 11/11/2007 11:21:22 AM

?? Missing Cmd C:\Test\Test2.cmd

?? Date Time 11/11/2007 11:21:22 AM

?? Missing Cmd D:\Download\Test2.cmd

?? Date Time 11/11/2007 11:21:22 AM

?? Missing Cmd Test3.cmd

?? Date Time 11/11/2007 11:21:22 AM

?? Missing Cmd C:\Scripts\Templates\Test4

?? Date Time 11/11/2007 11:21:22 AM

Save As HideCmd.vbs

Const ForReading = 1
'/-&gt; Objects
 Dim Act :Set Act = CreateObject("Wscript.Shell")
 Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
 Dim Env :Set Env = Act.Environment("Process")
'/-&gt; This Assumes The Text File Is In The Same Folder As This Script,
'/-&gt; Place Full Path To The Text File If It Not The Same Folder As The Script
 Dim Txt :Txt = "BatchList.txt"
 Dim Rpt :Rpt = Env("Windir") &amp; "\ReportBatch.log"
'/-&gt; Check To Make Sure The Text File Is There Before We Start The Cmds
  If Fso.FileExists(Txt) Then 
   Work()
  Else 
   Act.Popup "Error Missing File, " &amp; Txt,0,"Error No File",4128
  End If 
'/-&gt; Do All Text And Batch Processing In Work
   Function Work()
	Dim Arg1, Arg2, Ts1, Ts2, StrValue
	Set Ts1 = Fso.OpenTextFile(Txt,ForReading)
	Set Ts2 = Fso.CreateTextFile(Rpt)
	Arg1 = Chr(160) &amp; Chr(187)
'/-&gt; Loop For Text File
	Do Until Ts1.AtEndOfStream
	StrValue = Ts1.ReadLine
	Arg2 = vbTab &amp; StrValue &amp; vbCrLf &amp; Arg1 &amp; " Date Time  " &amp; vbTab &amp; Now() &amp; vbCrLf 
	 If Fso.FileExists(StrValue) Then	  
	  Ts2.WriteLine Arg1 &amp; " Confirm Cmd" &amp; Arg2
'/-&gt; Only Will Run If Exists
	  Act.Run(Chr(34) &amp; StrValue &amp; Chr(34)),0,True 
	 Else
	  Ts2.WriteLine Arg1 &amp; " Missing Cmd" &amp; Arg2
	 End If 
	Loop
	Ts1.Close
	Ts2.Close
   Act.Run("Notepad.exe " &amp; Rpt),1,True
   Dim Z1 
	Z1 = Act.Popup("Would you like to keep this log report?" &amp; vbCrLf &amp;_
	Rpt &amp; vbCrLf &amp; "Yes to keep the file No to Delete File.",30,"Keep Or Delete",4132)
	If Z1 = 7 Then Fso.DeleteFile(Rpt)
   End Function
Edited by jake1eye
Link to comment
Share on other sites

  • 0

1:\Copy all the text below the HideCmd.vbs

2:\ Open Notepad then paste

3:\Then save as HideCmd.vbs, make sure you select at the Save As Type

as All Files or you will end up with HideCmd.vbs.txt which will not work.

Link to comment
Share on other sites

  • 0
You can do what you want without any Third Party Apps, using a simple VBS script.

Here is an example VBS script I made.

1:\ Reads from a text file called BatchList.txt

2:\ Processes each line in the text file as a Varible

3:\ Runs the Batch or Cmd without showing the Cmd Promt Window

4:\ Creates a text file in the Windir and Named ReportBatch.log

5:\ Then list if the Cmd Ran or was Missing

6:\ Runs ReportBatch.log and when you close it ask if you want to keep it or delete it

Example Contents of BatchList.txt

Example Test1.cmd

I only made One cmd to test and had it direct it output to a text file to confirm it ran.

Example Contents of ReportBatch.log

I only made One cmd to test and had it direct it output to a text file to confirm it ran.

Save As HideCmd.vbs

Since I am putting this on a USB, the drive letter will be different everytime... so do I use * or # or % or something like that?

Thanks in advance,

Panarchy

Link to comment
Share on other sites

  • 0

If you want to use it on a USB drive, you will have to set an envrionment variable that points to the letter of the drive using the SET command.

keep in mind this variable only exists during that session.

Link to comment
Share on other sites

  • 0
Thanks... can you give me the code that shows me how?

Are you running the batch files from the usb drive and need the VBS to pick up the usb drive letter to run them?

If the reply is yes you need the VBS script to pick up the usb drive letter, could you try this script

and tell me if it reports the USB drive letter. I do not have a USB Drive so this script is just a guess.

Save as CheckUsbDrive.vbs

'/-&gt; Const Are Like Varibles But Never Change
Const ForReading = 1
'/-&gt; Varibles As Objects
 Dim Act :Set Act = CreateObject("Wscript.Shell")
 Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
 Dim Env :Set Env = Act.Environment("Process")
'/-&gt; Varibles For Listing Drives
 Dim Drv, ObjD, StrD, Err1
'/-&gt; Loop To List The Drives And Get A Drive Letter 
 For Each StrD In Fso.Drives
   If StrD.DriveType = 1 Then
	If StrD.IsReady Then
	 If InStr(StrD,"A") Or InStr(StrD,"a") Then
	 '/-&gt; Do Nothing It The Floppy Disk
	 Else
	 '/-&gt; This Should Be The Active Usb Drive
	  Drv = StrD
	  Err1 = 9999
	 End If
	 Else 
	Err1 = 9998
   End If
  End If 
 Next 
 If Err1 = 9999 Then 
  WScript.Echo Drv
 End If
 If Err1 = 9998 Then 
  WScript.Echo "The Drive Is Not Available, Or Plug In"
 End If

If this code does pick up the correct USB drive, I will modified the original script with the drive detection.

Link to comment
Share on other sites

  • 0

Here is the script with the added code

Save As UsbHideCmd.vbs

Const ForReading = 1
'/-&gt; Objects
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Env :Set Env = Act.Environment("Process")
'/-&gt; This Assumes The Text File Is In The Same Folder As This Script,
'/-&gt; Place Full Path To The Text File If It Not The Same Folder As The Script
Dim Txt :Txt = "BatchList.txt"
Dim Rpt :Rpt = Env("Windir") &amp; "\ReportBatch.log"
'/-&gt; Varibles For Listing Drives
Dim Drv, StrD, Err1
'/-&gt; Loop To List The Drives And Get A Drive Letter 
  For Each StrD In Fso.Drives
   If StrD.DriveType = 1 Then
	If StrD.IsReady Then
	 If InStr(StrD,"A") Or InStr(StrD,"a") Then
	 '/-&gt; Do Nothing It The Floppy Disk
	 Else
	 '/-&gt; This Should Be The Active Usb Drive
	  Drv = StrD
	  Err1 = 9999
	 End If
	 Else 
	  Err1 = 9998
	End If
   End If 
  Next
'/-&gt; Confirm Usb Drive Letter
  If Err1 = 9999 Then 
   CheckForTxt()
  End If
'/-&gt; Missing Usb Drive Letter
  If Err1 = 9998 Then 
   Act.Popup "The Drive Is Not Available, Or Plug In",0,"Error No Drive",4132
  End If
'/-&gt; Check To Make Sure The Text File Is There Before We Start The Cmds
   Function CheckForTxt()
	If Fso.FileExists(Txt) Then 
	 Work()
	Else 
	 Act.Popup "Error Missing File, " &amp; Txt,0,"Error No File",4128
	End If
   End Function
'/-&gt; Do All Text And Batch Processing In Work
   Function Work()
	Dim Arg1, Arg2, Ts1, Ts2, StrValue
	Set Ts1 = Fso.OpenTextFile(Txt,ForReading)
	Set Ts2 = Fso.CreateTextFile(Rpt)
	Arg1 = Chr(160) &amp; Chr(187)
'/-&gt; Loop For Text File
	Do Until Ts1.AtEndOfStream
	StrValue = Ts1.ReadLine
	Arg2 = vbTab &amp; StrValue &amp; vbCrLf &amp; Arg1 &amp; " Date Time  " &amp; vbTab &amp; Now() &amp; vbCrLf 
	 If Fso.FileExists(StrValue) Then	  
	  Ts2.WriteLine Arg1 &amp; " Confirm Cmd" &amp; Arg2
'/-&gt; Only Will Run If Exists
	  Act.Run(Chr(34) &amp; StrValue &amp; Chr(34)),0,True 
	 Else
	  Ts2.WriteLine Arg1 &amp; " Missing Cmd" &amp; Arg2
	 End If 
	Loop
	Ts1.Close
	Ts2.Close
   Act.Run("Notepad.exe " &amp; Rpt),1,True
   Dim Z1 
	Z1 = Act.Popup("Would you like to keep this log report?" &amp; vbCrLf &amp;_
	Rpt &amp; vbCrLf &amp; "Yes to keep the file No to Delete File.",30,"Keep Or Delete",4132)
	If Z1 = 7 Then Fso.DeleteFile(Rpt)
   End Function
Link to comment
Share on other sites

  • 0

Thanks.

Um... how do I write into the batchlist to say that I want something from the drive?

thanks in advance,

Panarchy

PS: Can you please take out the dialogs...

PPS: Can you please take out the features that show the user the logs... and can you please take out the log function. (thanks!)

Link to comment
Share on other sites

  • 0

I think I have fixed it;

Const ForReading = 1

'/-> Objects

Dim Act :Set Act = CreateObject("Wscript.Shell")

Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")

Dim Env :Set Env = Act.Environment("Process")

'/-> This Assumes The Text File Is In The Same Folder As This Script,

'/-> Place Full Path To The Text File If It Not The Same Folder As The Script

Dim Txt :Txt = "BatchList.txt"

Dim Rpt :Rpt = Env("Windir") & "\ReportBatch.log"

'/-> Varibles For Listing Drives

Dim Drv, StrD, Err1

'/-> Loop To List The Drives And Get A Drive Letter

For Each StrD In Fso.Drives

If StrD.DriveType = 1 Then

If StrD.IsReady Then

If InStr(StrD,"A") Or InStr(StrD,"a") Then

'/-> Do Nothing It The Floppy Disk

Else

'/-> This Should Be The Active Usb Drive

Drv = StrD

Err1 = 9999

End If

Else

Err1 = 9998

End If

End If

Next

'/-> Confirm Usb Drive Letter

If Err1 = 9999 Then

CheckForTxt()

End If

'/-> Missing Usb Drive Letter

'/If Err1 = 9998 Then

'/Act.Popup "The Drive Is Not Available, Or Plug In",0,"Error No Drive",4132

End If

'/-> Check To Make Sure The Text File Is There Before We Start The Cmds

Function CheckForTxt()

If Fso.FileExists(Txt) Then

Work()

Else

'Act.Popup "Error Missing File, " & Txt,0,"Error No File",4128

End If

End Function

'/-> Do All Text And Batch Processing In Work

Function Work()

Dim Arg1, Arg2, Ts1, Ts2, StrValue

Set Ts1 = Fso.OpenTextFile(Txt,ForReading)

Set Ts2 = Fso.CreateTextFile(Rpt)

Arg1 = Chr(160) & Chr(187)

'/-> Loop For Text File

Do Until Ts1.AtEndOfStream

StrValue = Ts1.ReadLine

Arg2 = vbTab & StrValue & vbCrLf & Arg1 & " Date Time " & vbTab & Now() & vbCrLf

If Fso.FileExists(StrValue) Then

Ts2.WriteLine Arg1 & " Confirm Cmd" & Arg2

'/-> Only Will Run If Exists

Act.Run(Chr(34) & StrValue & Chr(34)),0,True

Else

Ts2.WriteLine Arg1 & " Missing Cmd" & Arg2

End If

Loop

Ts1.Close

Ts2.Close

Act.Run("Notepad.exe " & Rpt),1,True

Dim Z1

'Z1 = Act.Popup("Would you like to keep this log report?" & vbCrLf &_

'Rpt & vbCrLf & "Yes to keep the file No to Delete File.",30,"Keep Or Delete",4132)

Then Fso.DeleteFile(Rpt)

End Function

If you see any problems in that, please fix for me!

Thanks in advance,

Panarchy

Link to comment
Share on other sites

  • 0
Thanks.

Um... how do I write into the batchlist to say that I want something from the drive?

thanks in advance,

Panarchy

PS: Can you please take out the dialogs...

PPS: Can you please take out the features that show the user the logs... and can you please take out the log function. (thanks!)

I was at MSFN today and saw that you posted a similar request and had the thread closed,

because you wanted

QUOTE(Panarchy @ Nov 12 2007, 11:40 AM)

^I don't mind... I am writing malicious code, so this is why I need it.

So I will not help you any more.

Link to comment
Share on other sites

  • 0

^What? I'm not writing malicious code, I am writing bat script that run automated tasks for me, and for whoever's computer I put this into. I am a network admin.

And the only reason I mentioned that on that forum, is because what I'm writing, is in fact, malicious code. (if you think about it)

Anyways, I think I fixed it here;

Const ForReading = 1

'/-> Objects

Dim Act :Set Act = CreateObject("Wscript.Shell")

Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")

Dim Env :Set Env = Act.Environment("Process")

'/-> This Assumes The Text File Is In The Same Folder As This Script,

'/-> Place Full Path To The Text File If It Not The Same Folder As The Script

Dim Txt :Txt = "BatchList.txt"

'Dim Rpt :Rpt = Env("Windir") & "\ReportBatch.log"

'/-> Varibles For Listing Drives

Dim Drv, StrD, Err1

'/-> Loop To List The Drives And Get A Drive Letter

For Each StrD In Fso.Drives

If StrD.DriveType = 1 Then

If StrD.IsReady Then

If InStr(StrD,"A") Or InStr(StrD,"a") Then

'/-> Do Nothing It The Floppy Disk

Else

'/-> This Should Be The Active Usb Drive

Drv = StrD

Err1 = 9999

End If

Else

Err1 = 9998

End If

End If

Next

'/-> Confirm Usb Drive Letter

If Err1 = 9999 Then

CheckForTxt()

End If

'/-> Missing Usb Drive Letter

'/If Err1 = 9998 Then

'/Act.Popup "The Drive Is Not Available, Or Plug In",0,"Error No Drive",4132

'End If

'/-> Check To Make Sure The Text File Is There Before We Start The Cmds

Function CheckForTxt()

If Fso.FileExists(Txt) Then

Work()

'Else

'Act.Popup "Error Missing File, " & Txt,0,"Error No File",4128

End If

End Function

'/-> Do All Text And Batch Processing In Work

Function Work()

Dim Arg1, Arg2, Ts1, Ts2, StrValue

Set Ts1 = Fso.OpenTextFile(Txt,ForReading)

'Set Ts2 = Fso.CreateTextFile(Rpt)

Arg1 = Chr(160) & Chr(187)

'/-> Loop For Text File

Do Until Ts1.AtEndOfStream

StrValue = Ts1.ReadLine

Arg2 = vbTab & StrValue & vbCrLf & Arg1 & " Date Time " & vbTab & Now() & vbCrLf

If Fso.FileExists(StrValue) Then

'Ts2.WriteLine Arg1 & " Confirm Cmd" & Arg2

'/-> Only Will Run If Exists

Act.Run(Chr(34) & StrValue & Chr(34)),0,True

Else

Ts2.WriteLine Arg1 & " Missing Cmd" & Arg2

End If

Loop

Ts1.Close

'Ts2.Close

'Act.Run("Notepad.exe " & Rpt),1,True

Dim Z1

'Z1 = Act.Popup("Would you like to keep this log report?" & vbCrLf &_

'Rpt & vbCrLf & "Yes to keep the file No to Delete File.",30,"Keep Or Delete",4132)

'Fso.DeleteFile(Rpt)

End Function

Is that right?

Please fix it if it isn't!

Panarchy

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.