Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#1
Post
by Dos_Probie » 11 Sep 2012 20:09
There are times when you don't need to see your console when running a file,
Here's a little .vbs script to hide your dos console, There are other 3rd party
files out there like cmdow but Microsoft Essentials, AVG etc. gives you a false/postive alert.
Dos_Probie
Code: Select all
''Hide your dos console screen - HideConsole.vbs''
CreateObject("Wscript.Shell").Run "MyBatchFile.cmd",0,True
-
e4nd
- Posts: 12
- Joined: 17 Mar 2012 02:28
#2
Post
by e4nd » 13 Sep 2012 10:33
"Convert" bat to vbs
Code: Select all
@echo off & setlocal enabledelayedexpansion
::
:: Skrypt ukrywający okno plików BAT by e4nd
::
set file_=plik.bat
::
::
for %%c in (%file_%) do (
if exist %%c (
copy %file_% %%~nc.BAK>nul
set ext=%%~nc
)else (
echo Brak pliku %file_% w wskazanej lokalizacji
pause & exit
)
)
:: Zamienia " na ""
for /f "tokens=* delims=" %%t in (%file_%) do (
set S=%%t
set S=!S:"=""!
echo !S! >>tmp
)
)
:VbsCreate
(
echo Dim oShell
echo set tmp = CreateObject^("Scripting.FileSystemObject"^)
echo set File = tmp.CreateTextFile^("tmp.bat", ForWriting^)
) >>%ext%.vbs
call :ReadFile
(
echo File.close
echo Set oShell = WScript.Createobject ^("WScript.Shell"^)
echo oShell.run "cmd /C tmp.bat" ,0
echo Set oShell = Nothing
) >>%ext%.vbs
pause
endlocal & goto :EOF
::
:ReadFile
::Dodaje do każdej linii File.WriteLine ("polecenie z pliku bat")
for /f "tokens=* delims=" %%r in ('type "tmp"') do (
echo File.WriteLine("%%r"^)>>%ext%.vbs
)
del /q tmp
goto :EOF
-
foxidrive
- Expert
- Posts: 6031
- Joined: 10 Feb 2012 02:20
#3
Post
by foxidrive » 13 Sep 2012 10:37
You may not realise - the comments/echos in the batch are not in English.
-
Dos_Probie
- Posts: 233
- Joined: 21 Nov 2010 08:07
- Location: At My Computer
#4
Post
by Dos_Probie » 13 Sep 2012 14:10
e4nd,
Thanks for your help but it's all Greek or Polish to me..