Gary Kuznitz | 12 Aug 2012 21:53

Renaming a folder

I would like to rename a folder.  But first I want to make sure the folder name I am 
using does not exist.  This is what I have:

Set i=1
:again
If exists C:\WINDOWS\SoftwareDistribution.old_%i%
set  /A i+=1
goto again
Set x=i
Set /A x+=1
ren C:\WINDOWS\SoftwareDistribution SoftwareDistribution.old_%x%

It isn't working.  How can I fix it?

Thanks,

Gary

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/batchworld/

<*> Your email settings:
    Individual Email | Traditional
(Continue reading)

Glenn B. Lawler | 12 Aug 2012 23:14
Favicon

RE: Renaming a folder

> I would like to rename a folder.  But first I want to make sure the folder
name
> I am using does not exist.  This is what I have:

Another approach would be to just rename the folder and check the ERRORLEVEL

REN sets ERRORLEVEL to 1 if another file or folder exists with the same
name.

Glenn Lawler
www.incodesystems.com

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/batchworld/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/batchworld/join
    (Yahoo! ID required)

<*> To change settings via email:
(Continue reading)

Gary Kuznitz | 13 Aug 2012 03:38

Re: Renaming a folder - I figured it out

This is what I came up with:

net stop WuAuServ
Set i=1
:again
If exist "C:\WINDOWS\SoftwareDistribution.old_%i%" (
set  /A i=i+1
goto again)
Set x=%i%
ren C:\WINDOWS\SoftwareDistribution SoftwareDistribution.old_%x%
net start WuAuServ

On 12 Aug 2012 at 12:53, batchworld@... (Gary Kuznitz 
<docfxit@...>) commented about Renaming a folder:

> I would like to rename a folder.  But first I want to make sure the folder name I am 
> using does not exist.  This is what I have:
> 
> Set i=1
> :again
> If exists C:\WINDOWS\SoftwareDistribution.old_%i%
> set  /A i+=1
> goto again
> Set x=i
> Set /A x+=1
> ren C:\WINDOWS\SoftwareDistribution SoftwareDistribution.old_%x%
> 
> It isn't working.  How can I fix it?
> 
> Thanks,
(Continue reading)

Gary Kuznitz | 22 Aug 2012 18:01

ASP.NET permissions

I'd like a bat file to set file/folder permissions when I install a web site with ASP.NET.
The permissions I need to set are here:
http://msdn.microsoft.com/en-us/library/kwzs111e.aspx

Thank you,

Docfxit

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/batchworld/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/batchworld/join
    (Yahoo! ID required)

<*> To change settings via email:
    batchworld-digest@... 
    batchworld-fullfeatured@...

<*> To unsubscribe from this group, send an email to:
(Continue reading)

Abhijat Singh | 29 Aug 2012 21:45

parse and filter a txt file

Hi All,
Is it possible to extract filtered data from a txt file using DOS?

I have a txt file with 6 fields separated by comma. One of those fields has an ID on which I want to apply filer.
The IDs that are to be used to apply filter and extract data are in another txt file. Much like: 
File1 - data.txt
a,s,d,f,AA,t
s,d,f,g,AA,g
d,f,g,h,BB,h
f,ge,tr,g,CC,k

File2 - ID.txt
AA,CC

The result should be 
a,s,d,f,AA,t
s,d,f,g,AA,g
f,ge,tr,g,CC,k

Thanks very much,
Abhijat.

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links

<*> To visit your group on the web, go to:
(Continue reading)

John O'Regan | 30 Aug 2012 13:05
Picon

Re: parse and filter a txt file

Dear Adhijat,

  Let me understand you correctly.  You're saying that you want to
read in a list of values from file2 and check each value in the list
against the second last field on every line of file1.  If there's a
match, output the entire line from file1.

  Is that what you're asking?  If so, then it should be fairly simple
to do.  Please let me know,

later,
John

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/batchworld/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/batchworld/join
    (Yahoo! ID required)

(Continue reading)

Abhijat Singh | 30 Aug 2012 13:57

Re: parse and filter a txt file

Hi John,
That's spot on.

Thanks,
Abhijat.

--- In batchworld@..., "John O'Regan" <john.a.oregan <at> ...> wrote:
>
> Dear Abhijat,
> 
>   Let me understand you correctly.  You're saying that you want to
> read in a list of values from file2 and check each value in the list
> against the second last field on every line of file1.  If there's a
> match, output the entire line from file1.
> 
>   Is that what you're asking?  If so, then it should be fairly simple
> to do.  Please let me know,
> 
> later,
> John
>

------------------------------------

To Post a message, send it to:   batchworld@...

To Unsubscribe, send a blank message to:
batchworld-unsubscribe@...! Groups Links

<*> To visit your group on the web, go to:
(Continue reading)

Abhijat Singh | 30 Aug 2012 13:59

Re: parse and filter a txt file

Hi John,
The only thing I would do differently is - instead of outputting the line from file1, I would create another
file, say file3 with all those lines of output.

Kind Regards,
Abhijat

--- In batchworld@..., "Abhijat Singh" <abhijat.singh <at> ...> wrote:
>
> Hi John,
> That's spot on.
> 
> Thanks,
> Abhijat.
> 
> --- In batchworld@..., "John O'Regan" <john.a.oregan <at> > wrote:
> >
> > Dear Abhijat,
> > 
> >   Let me understand you correctly.  You're saying that you want to
> > read in a list of values from file2 and check each value in the list
> > against the second last field on every line of file1.  If there's a
> > match, output the entire line from file1.
> > 
> >   Is that what you're asking?  If so, then it should be fairly simple
> > to do.  Please let me know,
> > 
> > later,
> > John
> >
(Continue reading)

John O'Regan | 31 Aug 2012 22:37
Picon

Re: parse and filter a txt file

Dear Adhijat,

Please review the following:

- - adhijat.cmd - -

 <at> echo off & setlocal enableextensions
set /a keycount=0,kc=0
type nul > matches.txt

for /f "delims=" %%a in (id.txt) do set "tail=%%a"

:chomp
for /f "tokens=1* delims=," %%b in ("%tail%") do (
set /a keycount+=1
call set "key%%keycount%%=%%b"
set "tail=%%c"
if "%tail%"=="" goto keys
goto chomp)

:keys
set /a kc+=1
call set "key=%%key%kc%%%"

for /f "delims=" %%d in (data.txt) ^
do for /f "tokens=5 delims=," %%e in ("%%d") ^
do if /i "%key%"=="%%e" >>matches.txt echo(%%d

if %kc% lss %keycount% goto keys

(Continue reading)


Gmane