Search found 80 matches

by RElliott63
30 Jul 2009 09:46
Forum: DOS Batch Forum
Topic: Substrings with DOS
Replies: 2
Views: 5645

From the "Help For" In addition, substitution of FOR variable references has been enhanced You can now use the following optional syntax: %~I - expands %I removing any surrounding quotes (") %~fI - expands %I to a fully qualified path name %~dI - expands %I to a drive letter o...
by RElliott63
27 Jul 2009 06:39
Forum: DOS Batch Forum
Topic: How to map drive and open folder
Replies: 5
Views: 8147

Brian, Your command to connect is like this: Net Use %Drive% /Delete 1>Nul 2>Nul Net Use %Drive% \\location\H$ 1>NUL 2>NUL I would assume that you don't need a UserID/Password if it's on your own machine... if not, you might have to add the /User and password to the command. If on a multi-person com...
by RElliott63
21 Jul 2009 16:25
Forum: DOS Batch Forum
Topic: Create an empty text document?
Replies: 2
Views: 4674

Echo > FName.ext ; will create and/or replace any current document with that name

Echo >> FName.exe ; will append data to the current document with that name
by RElliott63
10 Jul 2009 09:50
Forum: DOS Batch Forum
Topic: IF File Exist
Replies: 3
Views: 14239

Re: IF File Exist

echo off if not exist "C:\Folder A\File Q.txt" goto ELSE echo The file C:\Folder A\File Q.txt DOES exist. >> "IF Test Results.txt" goto END ELSE echo The file C:\Folder A\File Q.txt DOES NOT exist. >> "IF Test Results.txt" :END Try something like this ... echo off if n...
by RElliott63
07 Jul 2009 23:59
Forum: DOS Batch Forum
Topic: Custom directory listing
Replies: 4
Views: 6338

OK, try this... it should help you get somewhere with it... @Echo Off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION for /d %%d in (%APPDATA%\Mozilla\Firefox %LOCALAPPDATA%\Mozilla\Firefox) do ( if exist %%d\*.sqlite ( for /f %%f in ('Dir /b %%d\*.sqlite') do (...
by RElliott63
07 Jul 2009 09:24
Forum: DOS Batch Forum
Topic: Custom directory listing
Replies: 4
Views: 6338

Marrone,

What's the error you're receiving? If the %AppData% or %LocalAppData% have spaces in it, then you won't get the whole path presented in %%d, thus not finding the actual folder you're looking for.

You might want to use quotes and remove them with %%~D as needed.

-Rick
by RElliott63
06 Jul 2009 21:47
Forum: DOS Batch Forum
Topic: Batch File To Display Directory Size
Replies: 4
Views: 12771

Paulo, %1 should be the directory you want to run the summation for... You could do this: DirSize "C:\FolderName" @echo off setLocal EnableDelayedExpansion If /i [%~1] equ [] ( Cls Echo Gotta have a Folder to calculate! Goto Exit ) set Fldr="%~1" set /a sum=0 FOR /D %%D i...
by RElliott63
06 Jul 2009 21:30
Forum: DOS Batch Forum
Topic: Filename to DateTime
Replies: 9
Views: 10782

Same song, 2nd verse! This encompasses the Folder name in quotes since it has spaces in it Before you just said put the Date/Time into the name, you didn't specify that you wanted the file Date/Time. This takes care of that issue as well. This assumes your file date/time are echoed in the "02/...
by RElliott63
06 Jul 2009 21:11
Forum: DOS Batch Forum
Topic: Listing files with exclusion
Replies: 13
Views: 15507

Yes... @Echo Off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION Set "Ignore=%1" If /I [%Ignore%] equ [] Goto Syntax For /F %%F in ('Dir /b') Do ( Set "Ext=%%~xF" If /I [!Ext!] neq [%Ignore%] ( Echo %%~ftzaF ) ) Goto Exit :Syntax Cls Echo; Echo D...
by RElliott63
06 Jul 2009 13:31
Forum: DOS Batch Forum
Topic: Filename to DateTime
Replies: 9
Views: 10782

Same song, 2nd verse! This encompasses the Folder name in quotes since it has spaces in it Before you just said put the Date/Time into the name, you didn't specify that you wanted the file Date/Time. This takes care of that issue as well. This assumes your file date/time are echoed in the "02/0...
by RElliott63
06 Jul 2009 11:04
Forum: DOS Batch Forum
Topic: Batch File To Display Directory Size
Replies: 4
Views: 12771

Remove the %%D from the 2nd FOR Loop .. .as in:

Code: Select all

@echo off
setLocal EnableDelayedExpansion
set /a sum=0
FOR /d %%D in (%1) do (
  FOR /R %%I IN (*) DO (
    set /a value=%%~zI/1024
    set /a sum=!sum!+!value!
  )
)
echo Size is: !sum! k
by RElliott63
06 Jul 2009 09:55
Forum: DOS Batch Forum
Topic: Filename to DateTime
Replies: 9
Views: 10782

You can start with this... might need some tweaking, but you should get the jist. @Echo Off Set "Unique=x" Set "Fldr=H:\Acronis\AA1 III White" Call :GetUnique Unique Dir /b %Fldr%\*MyBackup* > %Temp%\Dir.Lst For /F %%F in (%Temp%\Dir.Lst) do ( Echo Old Filename was: %...
by RElliott63
06 Jul 2009 09:18
Forum: DOS Batch Forum
Topic: String: left-justification with spaces
Replies: 1
Views: 3787

Just look at the main web page here...

Align Right
http://www.dostips.com/DtTipsStringOperations.php#Snippets.AlignRight
by RElliott63
06 Jul 2009 07:00
Forum: DOS Batch Forum
Topic: Listing files with exclusion
Replies: 13
Views: 15507

Since this isn't a VB Script forum.... try this: Save this as DirX.bat @Echo Off SETLOCAL ENABLEEXTENSIONS SETLOCAL ENABLEDELAYEDEXPANSION Set "Ignore=%1" If /I [%Ignore%] equ [] Goto Syntax Dir /b > %Temp%\Dir.Lst For /F %%F in (%Temp%\Dir.Lst) Do ( Set "Ext=%%~xF" I...
by RElliott63
24 Jun 2009 08:50
Forum: DOS Batch Forum
Topic: Batch File -Date & Time
Replies: 1
Views: 4463

Here's a start .. might want to adjust due to regional settings for dates or others... Set "ftpFile=Script.ftp" Set "ftpIP=xxx.xxx.xxx.xxx" Set "DD=%Date:~3,2%" REM Get Day Set "MM=%Date:~0,2%" REM Get Month Set "YY=%Date:~6,4%" REM Get Year Set &quo...