Computer Hope

Microsoft => Microsoft DOS => Topic started by: shreked on April 27, 2018, 11:22:26 AM

Title: Big Plea. Can anyone help on finishing off a script as completely confused ....
Post by: shreked on April 27, 2018, 11:22:26 AM
Hi

Ive sort of got my head round what I need to do but need one or two minor adjustments made as I dont know where they go as im totally confused with .msdos unless it written out for me.

I have the following .MSDOS and  .VBS script that creates a folder &  zips it

What I need to do in addition  is the following.

1) When it puts it into a folder I need it to ask me to input a password . When password input I then need it to move onto the .DOS command of zipping

2) What I also need is instead of it just creating a 7Z file with the name of zipped.7z I need it to be the same name as what the folder was called originally.
I was advised of some code like this but aint got a clue on what it is or where it to go in script.

Code: Select all

@echo off
echo(The first command line argument is "%~1".

Code: Select all

Z:\>example.bat "argA" "argB"
The first command line argument is "argA".

CAN I MAKE ONE BIG BIG PLEA AND CAN YOU POSSIBLY AMEND MY SCRIPT BELOW AND JUST REPOST FOR ME PLEASE PLEASE   :'(


 ORIGINAL SCRIPTS  BELOW


Option Explicit

Const strDLFolder = "C:\Downloads"
Dim objFSO, objWShell, objDLFolder, strNewFolder, objFile

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWShell = CreateObject("WScript.Shell")

If Not objFSO.FolderExists(strDLFolder) Then objFSO.CreateFolder(strDLFolder)
objWShell.CurrentDirectory = strDLFolder
Set objDLFolder = objFSO.GetFolder(strDLFolder)
If objDLFolder.Files.Count = 0 Then WScript.Quit

Do
Err.Clear
strNewFolder = InputBox("Folder Name", vbLf & "Enter the name of the folder to be created:")
If strNewFolder = False Then WScript.Quit
On Error Resume Next
objFSO.CreateFolder strNewFolder
Loop While Err.Number <> 0 Or Not objFSO.FolderExists(strNewFolder)

On Error Goto 0
For Each objFile In objDLFolder.Files
objFSO.MoveFile objFile.Name, strNewFolder & "\"
Next

objWShell.Popup "All files moved.", 0, "Done", vbInformation Or vbSystemModal Or &h00040000&

dim dotbat
set dotbat=createobject("wscript.shell")
dotbat.Run "C:\Users\icc.cctv\Documents\DONOTDELETE1.bat", 1, True
set dotbat=Nothing

@echo off&PUSHD "%PROGRAMFILES%\7-zip"&cls
echo MAKE SURE YOU HAVE ENTERED
echo STATEMENT INTO FOLDER BEFORE
echo CONTINUING^^!&echo.
echo [1] I'VE DONE THAT
echo [2] I'VE FORGOTTEN THAT
choice /c 12 /n>nul
if '%errorlevel%'=='2' (
cls&echo ENTER THE STATEMENT INTO FOLDER,
echo THIS WINDOW WILL CLOSE IN 5 SEC.
) else (
cls
7z a -t7z "C:\Downloads\zipped.7z" "C:\Downloads"
echo.&echo ALL FILES MOVED^^!
)
timeout 5 /NOBREAK >nul&exit/b


big big thanks in advance



Title: Re: Big Plea. Can anyone help on finishing off a script as completely confused ....
Post by: patio on April 27, 2018, 11:30:28 AM
All you did was re-word your original request which was locked...so i'm lockin this one too.