Search found 908 matches

by ShadowThief
17 Oct 2013 08:27
Forum: DOS Batch Forum
Topic: center text with echo
Replies: 6
Views: 6655

Re: center text with echo

First, figure out how wide your terminal window is. The default is 80 characters, but yours might be different. Next, find the length of the string you wish to center. There are some string length calculation functions on this site, I assume you know how to search. Then subtract the length of the st...
by ShadowThief
17 Oct 2013 06:20
Forum: DOS Batch Forum
Topic: Increment an integer without SET
Replies: 14
Views: 3329

Re: Increment an integer without SET

I'd be really curious to see how somebody could change the value of a variable without using SET.

Closest thing I can think would be

Code: Select all

for /L %%A in (0,1,8191) do (
    rem whatever you're doing with %%A
)
by ShadowThief
14 Oct 2013 15:17
Forum: DOS Batch Forum
Topic: CMD resources on Windows Xp
Replies: 1
Views: 769

Re: CMD resources on Windows Xp

All valid XP commands: http://www.microsoft.com/resources/docu ... x?mfr=true
All valid Vista/7/8/Server 2003/Server 2008 commands: http://technet.microsoft.com/en-us/libr ... 10%29.aspx
by ShadowThief
14 Oct 2013 00:14
Forum: DOS Batch Forum
Topic: another output problem [solved]
Replies: 2
Views: 822

Re: another output problem

The variables aren't printing, right?

Change %color% to %%color%%
Change %computername% to %%computername%%
Change %seconds% to %%seconds%%
by ShadowThief
13 Oct 2013 13:17
Forum: DOS Batch Forum
Topic: [SOLVED]Switches and parameters for creating tasks
Replies: 19
Views: 6275

Re: How to pick which switches and parameters for creating t

Closest thing I can find would be to try calling the batch file with

Code: Select all

start /min
which MIGHT work, but I haven't tested it.
by ShadowThief
09 Oct 2013 22:20
Forum: DOS Batch Forum
Topic: Getting user input with a prompt
Replies: 2
Views: 884

Re: Creating a batch that sets time/date ahead 33 days possi

Code: Select all

set /p "c=Make your selection: "
by ShadowThief
09 Oct 2013 20:57
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 3235

Re: Automatically deleting oldest directories

An easier way would be that if it's only one folder, you can say

Code: Select all

cmd /c if not @path==C:\path\you\want\to\ignore rd /s /q @path
by ShadowThief
07 Oct 2013 17:04
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 3235

Re: Automatically deleting oldest directories

foxidrive wrote:
ShadowThief wrote:the "if @isdir==TRUE" is unnecessary because RD only deletes directories


You'll get an error for every file though.

But it won't affect anything. If it really bothers you, you can throw a 2>nul at the end
by ShadowThief
07 Oct 2013 12:50
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 3235

Re: Automatically deleting oldest directories

Endoro wrote:try this (make a backup before):

Code: Select all

@echo off
forfiles /p "G:\VERITAS\B2D"  /d -5 /c "cmd /c if @isdir==TRUE rd /s /q @path"

Also look at "forfiles /?" at the command prompt.

the "if @isdir==TRUE" is unnecessary because RD only deletes directories
by ShadowThief
07 Oct 2013 10:10
Forum: DOS Batch Forum
Topic: Automatically deleting oldest directories
Replies: 13
Views: 3235

Re: Automatically deleting oldest directories

instead of del @path you can use rd @path
by ShadowThief
27 Sep 2013 16:58
Forum: DOS Batch Forum
Topic: FTP - in one batch file?
Replies: 40
Views: 8281

Re: FTP - in one batch file?

test

Code: Select all

[color=red]test[/color]


Same BBcode, but the code tag prevents the color tag from being used.
by ShadowThief
27 Sep 2013 15:41
Forum: DOS Batch Forum
Topic: FTP - in one batch file?
Replies: 40
Views: 8281

Re: FTP - in one batch file?

Adrianvdh wrote:P.P.S WT FAQ? Why won't phpBB allow me to colour/color stuff?

because the code tag breaks formatting
by ShadowThief
17 Sep 2013 17:01
Forum: DOS Batch Forum
Topic: How to replace windows 7 system files ?
Replies: 5
Views: 1590

Re: How to replace windows 7 system files ?

Just out of curiosity, why ARE you replacing system files?
by ShadowThief
13 Sep 2013 22:12
Forum: DOS Batch Forum
Topic: stripping spaces from text file input
Replies: 7
Views: 2127

Re: stripping spaces from text file input

Removing every single space?

Change

Code: Select all

echo !string: ,=,!>>%tempfile%
to

Code: Select all

echo !string: =!>>%tempfile%
and you're done

EDIT: oops, left a comma in there by accident :-\
by ShadowThief
13 Sep 2013 21:39
Forum: DOS Batch Forum
Topic: stripping spaces from text file input
Replies: 7
Views: 2127

Re: stripping spaces from text file input

Since you have spaces in there that you want to keep, you first have to change the space-comma to just a comma, then you can split on commas. @echo off setlocal enabledelayedexpansion set inputfile=part_5.csv set tempfile=tempfile.txt :: Change the space-commas into commas for /f "tokens=* deli...