Content Type
Profiles
Forums
Events
Everything posted by Yzöwl
-
help to IF NOT EXIST batch command
Yzöwl replied to ZEUS__'s topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Or perhaps this would make more sense… @CWND /HIDE @ START /WAIT wlm2009_416.exe COPY "Windows Live Messenger.lnk" "%AllUsersProfile%\Desktop" IF NOT EXIST "%ProgramFiles%\Winamp\Plugins\gen_MSN.dll" ( COPY "gen_MSN.dll" "%ProgramFiles%\Winamp\Plugins") IF NOT EXIST "%ProgramFiles%\AIMP2\Plugins\gen_msn7.dll" ( IF NOT EXIST "%ProgramFiles%\AIMP2\Plugins" ( MD "%ProgramFiles%\AIMP2\Plugins") COPY "gen_msn7.dll" "%ProgramFiles%\AIMP2\Plugins")The @Echo off wasn't required because the window was being hidden! XCOPY isn't required since none of its special switches are required! There's no need to check for the existence of the AIMP\Plugins directory unless the file doesn't exist, (that location would exist if the file was found in it)! There's likely no need for the EXIT command, the script should end on its own! -
I would suggest that the problem is likely with your hard disk drive too. Most manufacturers offer free drive check/testing utilities, however Toshiba doesn't. Their drives can usually be checked using the free tool provided for Hitachi drives. Since you've stated that the OS has been re-installed etc. I'd also strongly suggest that you ensure that all of the proper drivers etc. are installed and working correctly before touching additional software installations.
-
There's nothing really bad there, however some observations: My code used this line: if /i %continue%' neq y' goto...whereas yours uses: IF /I %continue%==N GOTO...The problem I have with it is that because there's no error trapping on what is user entered, your code will execute the command unless told explicitly not to, mine will only execute it if eplicitly told to do so! My code allows that the user can choose Y or N for any of the listed destination directories, yours allows for Y or N to ALL or NONE! There is no requirement to enable delayed expansion in your script so it would be prudent not to do so. The %_filelist% variable is commented out however it doesn't get a mention anywhere! It is common practice to use a max 80 character line length for your code, (as I did in the example I provided). It also means that following that convention you'd not have the long For loop with all of the ampersands: SET _destination="C:\temp\dest 1" "C:\temp\dest 2" "C:\temp\dest 3" SET _destination=%_destination% "C:\temp\dest 4" "C:\temp\dest 5" FOR %%# IN (%_destination%) DO (ECHO=&ECHO=-Updating %%G ROBOCOPY.EXE %_source% %%G %_excludedfiles% %_excludedirs% %_options%) At the end of your Run Backup Job section you have a GOTO _END statement to go to what is already the next command, it is therefore not required.
-
I hope this suits your purpose! @echo off:: Defaults:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: Set variablesset _sourcedir=C:\temp\copy1set _options=/MIR /XJ /NJH /NDL /NJS /NS /NC /R:1 /W:10set _destlist=H:\Backups "F:\Backup Drive" E:\Backup_2:: Loop through list of destination directoriesfor %%# in (%_destlist%) do call :_continue %%~#:: Exit:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::_endecho=echo=Backup job complete, press any key to exit...pause>nulgoto :eof:: Confirmation:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::_continueset _destdir=%*clsecho=-------------------------------------------------------------------------^------echo=Backup Script:echo=-------------------------------------------------------------------------^------echo=echo=Backup Source folder(s):echo ------------------------echo=[%_sourcedir%]echo=echo Backup Destination folder(s):echo=-----------------------------echo=[%_destdir%]echo=echo=Press CTRL+C at any time to stop the transfer.echo=set/p "continue=Proceed? [Y/N]: "if /i %continue%' neq y' goto :eof:: Run Backup Job:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::clsecho=echo=Updating [%_destdir%]:robocopy "%_sourcedir%" "%_destdir%" %_options%pause
-
Need help formatting a cmd in Runonce
Yzöwl replied to goatfuzz's topic in Unattended Windows 2000/XP/2003
Why delete it when you can just disable it? RUNONCEEX<snippet>.CMD REG ADD %KEY%\695 /VE /D "Disabling ASP.NET User Account" /f REG ADD %KEY%\695 /V 1 /D "net user aspnet /active:no" /fWhere you've obviously already defined %KEY% and not already used '695'. -
Filedelete script is not deleting all the files
Yzöwl replied to nice_guy75's topic in Unattended Windows 7/Server 2008R2
Are you sure that attributes will not create a problem for you? Not only is ProgramData a hidden directory but both the Startup directories contain at least one file, desktop.ini, which is a System and Hidden file. -
I'd forgotten all about this, below is an attachment containing the script as a standalone. Just drag and drop the file to be tidied onto it, (or give the file as a parameter) The file you give it as a parameter can either be cabbed or otherwise and should be returned to that format within the script. Dfrg_Inf.zip This is not designed to work on all inf/ini files due to 'poison' characters and can take a while due to limitations in the language used. It was used in the past however on my txtsetup.sif which as you know is a very large text file.
-
Just a quick note, since you are running WMIC for the first time on the system, there will be a short delay before it is invoked whilst it is registered/installed.
-
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Just remember as I intimated in my first response in this topic, if your current directory already has an archive named using this method inside it then you'll be archiving it inside another! BTW, now we've got to the bottom of your situation here's a slightly shortened version of the script, (two lines): Z.BAT @ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION FOR %%# IN (.) DO "%PROGRAMFILES%\WINRAR\RAR" A -R -EP1 "%%~nx#.rar" "%%~f#\*" Incidentally, you may note that my name here is Yzöwl, If you look at the side panel you'll note that calling me Wise Owl throughout this conversation would be equivalent to me calling you Newbie or jaclaz MSFN SuperB! -
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
I'm still not with you, where are you typing z?If you are inside a directory and you type z, then z.bat must be either inside that directory or somewhere within %path%. If z.bat is inside the directory then it would serve little purpose so I'd assume that we're talking about the latter. If such is the case try this as your batch file: Z.BAT @ECHO OFF SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION FOR %%# IN (.) DO (SET CF=%%~f# SET DN=%%~nx#) "%PROGRAMFILES%\WINRAR\RAR" A -R -EP1 "%DN%.rar" "%CF%\*" ENDLOCAL GOTO :EOF -
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Well that tells me something which I would have ascertained earlier had you provide a response to jaclaz when asked in post number 11. It appears that you may not have variable expansion working, try this: In your console window launch a new window using this commandSTART CMD /E:ON In that window use the example I've provided, (Do not omit the "%~f1\*" from the end). Then let us know what happens. -
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
The Drag and Drop, (especially in your stated XP Pro x86), does not function any differently from the method you are using. Basically it is an automatic, (GUI), way of running the batch file with the dropped file as the parameter %1. The only way to archive your entire C: drive would be for you to have either provided it as THE REQUIRED PARAMETER or not to have provided a parameter at all. Since your example used a parameter in the same way, I presumed you were fully aware of this functionality. Armed with this knowledge, try all three of my examples again and choose the one which suits your purpose. The first example places the archive inside you source folder, the second along side the batch file and the third in the current directory. -
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
You need to learn to follow instructions, I told you to drag and drop the source folder onto the batch file, it works flawlessly, there is no way it can do what you have stated unless you have failed to provide the source file parameter to the script.You also need to explain what you mean by "current directory I am in". Is this the location in which the batch file is located or some other location. we need to know how you are running this batch file and from where! To create the archive in the Current Directory, you shouldn't need to provide the location, it should be the default. RARMe_3.cmd @"%ProgramFiles%\WinRAR\rar" a -r -ep1 "%~nx1.rar" "%~f1\*"In your batch file or console change to the directory you want as your current directory, then run the batch file like this: PathTo\RARMe_3.cmd "D:\My Backups\This Week"Where the quoted location is that of the source directory you wish to archive. -
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
What is wrong with the solution I've provided, which you've thus far ignored? If it is that the produced archive is created inside the source folder as opposed to along side the batch file then simply change it to this! RARMe_2.cmd @"%ProgramFiles%\WinRAR\rar" a -r -ep1 "%~dp0%~nx1.rar" "%~f1\*" -
DOS Batch File
Yzöwl replied to Phaedrus's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Here's a starter for you. (just drag and drop your source directory onto it). RARMe.cmd @"%ProgramFiles%\WinRAR\rar" a -r -ep1 "%~f1\%~nx1.rar" "%~f1\*" If I correctly understood what you were attempting, this should be fine. But there are situations where it may need tweaking, such as ensuring that the source directory doesn't already contain a previous archive of the same name. -
If my example doesn't work for you, the likely explanation is that you've changed it in some way. It is important that you change only the two allowed MACs, not any of the formatting etc. The change may or may not be intentional so I've uploaded a working copy for you to test. MyMACs.zip
-
Since you stated Windows XP, what about using WMIC! @ECHO OFF & SETLOCAL SET "_=" FOR /F "SKIP=1 TOKENS=*" %%# IN ('WMIC NICConfig WHERE "MACAddress = '11:50:8D:95:31:B2' OR MACAddress = '00:18:F3:A3:39:BE'" GET Description 2^>Nul') DO CALL :A %%# IF NOT DEFINED _ (ECHO=RD/S/Q %SystemRoot%\System32) GOTO :EOF :A IF "%*" NEQ "" SET "_=T"When your happy that it works correctly remove ECHO= from line 6
-
Batch script list drives.
Yzöwl replied to Valerie's topic in Programming (C++, Delphi, VB/VBS, CMD/batch, etc.)
Or:@FOR /F "TOKENS=* DELIMS=," %%# IN ('WMIC LOGICALDISK GET NAME^, DESCRIPTION^ /FORMAT:CSV^|FIND ":"') DO @FOR /F "TOKENS=2,3 DELIMS=," %%A IN ("%%#" ) DO @ECHO %%B %%A) -
Anti malware toolkit will not load
Yzöwl replied to xboxhaxorz's topic in Malware Prevention and Security
First of all I believe that MBAM is 'Freeware' and links to filesharing sites for it are not necessary, second of all the latest version I believe is 1.45. -
Yes! TBH, it's not needed, I just failed to remove it from the code I copy/pasted it off! @ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION FOR /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% VARIABLE ECHO=[%INSTALL%]
-
@ECHO OFF & SETLOCAL ENABLEEXTENSIONS DISABLEDELAYEDEXPANSION FOR /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% VARIABLE ECHO=[%INSTALL%]
-
@bphlpt, I don't use it any more, it was originally intended to be used to break down large cmd scripts into smaller idividual scripts by their labels, but I found it more useful in the unattended arena for tidying the txtsetup.sif, dosnet.inf files etc. I don't use it any more for those purposes because I haven't created unattended media for a good few years now. @Mim0; More feasible isn't really the point. tommyp doesn't wish to introduuce bugs into the system, therefore the need is to produce a solution which handles a broad range of situations, (possibly more than we need it for). Basically the requirement should be for a solution which can be used on any of our ini, inf, sif type files. It should be able to work on any of those types regardless of whether they are or are not compressed and most importantly not mess with any of the content due to the inadequacies of the scripting language. Also due to the old timers and pensioners here it should ideally be able to work on Windows XP and Windows 2000! Our ideal would be to be able to either call a 'label' in the main script to defrag one or more files or to include a seperate script which can be called as an option. I'd go along with the latter, at least for a period of time, in order that any potential untested bugs can be ironed out without destroying the main script. @All; I'll try to dig the script out and see how difficult it would be to make it more broad-ranging for HFSlip or standalone purposes and keep you posted.