April 3, 201016 yr ok what i need to do is to find a certain folder in all drives so that I could set it as variable... likeset INSTALL=D:\Installerbut I don't know how to find it or set it, if that Folder does not exist on that drive..., just for curiosity also to install apps easily...
April 3, 201016 yr @ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSIONFOR /F "TOKENS=1" %%# IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO ( IF EXIST %%#INSTALLER SET "INSTALL=%%#Installer")IF NOT DEFINED INSTALL GOTO :EOF:: REST OF CODE BELOW HERE::EXAMPLE COMMAND USING %INSTALL% VARIABLEECHO=[%INSTALL%]
April 3, 201016 yr Author wow awesome way of using commands...btw does :EOF works without using exit command for it??what "TOKENS=1" stands for??Thanks for your batch
April 3, 201016 yr does :EOF works without using exit command for it??Yes!what "TOKENS=1" stands for??TBH, it's not needed, I just failed to remove it from the code I copy/pasted it off!@ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSIONFOR /F %%# IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO ( IF EXIST %%#INSTALLER SET "INSTALL=%%#Installer")IF NOT DEFINED INSTALL GOTO :EOF:: REST OF CODE BELOW HERE::EXAMPLE COMMAND USING %INSTALL% VARIABLEECHO=[%INSTALL%]
April 3, 201016 yr For the record, this is Windows 7 "Batch language" or "Command interpreter" or "Command line" or "Command console", NOT DOS. jaclaz
April 3, 201016 yr Here is how you would do it using VBS scripting.Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")Dim Drv, Loc'-> Search All Drives For Installer Folder For Each Drv In Fso.Drives If Fso.FolderExists(Drv & "\Installer") Then Loc = Drv & "\Installer" Next'-> Check The Resuts Of Searching The Drives If Len(Loc) > 2 Then MsgBox Loc,4128,"Confirm Folder" Else MsgBox "Can Not Find The Installer Folder",4128,"Missing Folder" End If
April 4, 201016 yr Author @jaclazwell I got used to call it DOS , since it was originally called DOS program but thanks for correcting...well thanks guys!!! hope that I can study programming also xD
Create an account or sign in to comment