Search found 3737 matches

by aGerman
01 Jul 2010 10:35
Forum: DOS Batch Forum
Topic: Pros and Cons of starting a script "setlocal"
Replies: 5
Views: 2930

Re: Pros and Cons of starting a script "setlocal"

Alan

I fell on the floor laughing when I read your post - thanks for the story.

ymmd :D
aGerman
by aGerman
01 Jul 2010 06:04
Forum: DOS Batch Forum
Topic: Variable and installation
Replies: 5
Views: 2151

Re: Variable and installation

Think you could use a FOR loop to read the file. So you can use allways the same variable fo each iteration. ABC.txt 123.456.234.567 345.678.456.789 batch file @echo off &setlocal for /f %%a in (ABC.txt) do ( set "IPaddr=%%a" call :proc ) pause goto :eof :: ~~~~~~~~ :proc echo %IPaddr%...
by aGerman
01 Jul 2010 02:41
Forum: DOS Batch Forum
Topic: How to pickup null value in variable
Replies: 3
Views: 2396

Re: How to pickup null value in variable

Yes, that is also a possibility.
Indeed the result of if "%input%"=="" ... is the same like my suggestion if not defined input ...

Regards
aGerman
by aGerman
01 Jul 2010 01:03
Forum: DOS Batch Forum
Topic: How to pickup null value in variable
Replies: 3
Views: 2396

Re: How to pickup null value in variable

Have a look at this @echo off &setlocal :: destoy the %input% in case you set any value before set "input=" :: Wait for user input set /p "input=Enter your value: " :: variable input is "not defined" in case the user entered nothing if not defined input ( echo you e...
by aGerman
30 Jun 2010 17:49
Forum: DOS Batch Forum
Topic: Basic compound variable problem
Replies: 5
Views: 2497

Re: Basic compound variable problem

You don't need all these variables. Use a simple FOR loop: @echo off &setlocal for /f "usebackq tokens=3" %%i in ("your.txt") do ( call set "size=%%x%%" set "x=%%i" ) echo %size% pause You could also process the DIR command directly @echo off &setlocal...
by aGerman
30 Jun 2010 15:49
Forum: DOS Batch Forum
Topic: Pros and Cons of starting a script "setlocal"
Replies: 5
Views: 2930

Re: Pros and Cons of starting a script "setlocal"

Hello Alan. The SETLOCAL command is absolutely useless if you would always run the batch file by double clicking it. I have often opened a command prompt for testing command lines or batch files. If you would drag'n'drop several batch files to this command prompt they run into the same parent cmd pr...
by aGerman
30 Jun 2010 13:37
Forum: DOS Batch Forum
Topic: Executing .EXE file with parameters that returns value
Replies: 1
Views: 1401

Re: Executing .EXE file with parameters that returns value

what i am missing is that the exe file returns a value and that value is one of the parameters that i have sent to my exe file Your have sent 4 Parameters: "John" "Peter" "Marco" "Philip". can someone help me finish my batch file No. Nobody knows which .exe f...
by aGerman
30 Jun 2010 13:23
Forum: DOS Batch Forum
Topic: how do i get a batch file to tell the defferince between
Replies: 1
Views: 1303

Re: how do i get a batch file to tell the defferince between

Hmm, I don't know what exactly you need. You could use a batch file with a command and /? in each line to get the Windows help for this command. In case a command has a different or additional syntax, you would find a passage starting with If Command Extensions are enabled ... That means these thing...
by aGerman
30 Jun 2010 11:16
Forum: DOS Batch Forum
Topic: Moving Files to seperate folder using a .BAT
Replies: 13
Views: 4139

Re: Moving Files to seperate folder using a .BAT

It's no problem. You would need one more FOR loop to split the file name on the first space. @echo off &setlocal pushd "D:\Files" for %%a in (*.pdf) do ( for /f "tokens=1*" %%b in ("%%~na") do ( md "D:\Folders\%%c" 2>nul move "%%a" "D:\Folde...
by aGerman
29 Jun 2010 17:17
Forum: DOS Batch Forum
Topic: Moving Files to seperate folder using a .BAT
Replies: 13
Views: 4139

Re: Moving Files to seperate folder using a .BAT

@echo off &setlocal pushd "D:\Files" for %%a in (*.pdf) do ( md "D:\Folders\%%~na" 2>nul move "%%a" "D:\Folders\%%~na\" ) popd pause In your first post it seems all files are .pdf files. If that isn't true, come back with further informations. Regards aGe...
by aGerman
29 Jun 2010 16:03
Forum: DOS Batch Forum
Topic: BEWARE OF SPAM
Replies: 3
Views: 2358

Re: BEWARE OF SPAM

If you notice a post that doesn't belong to the forum, login and open it. In the lower right corner of the post you will find an exclamation mark. Click it to alert the administrator.

BTW: I did it for these three postings of ReteddyOdor.

Regards
aGerman
by aGerman
29 Jun 2010 06:55
Forum: DOS Batch Forum
Topic: Need some help with explanation
Replies: 5
Views: 2850

Re: Need some help with explanation

Well, you read in a file that is given as parameter (%1). In this file the values are separated by semicolon. Into the FOR loops you use the semicolon as delimiter to split each line into parts (tokens). It is defined, that the first 5 tokens are returned and the whole rest of the line (*) is in the...
by aGerman
29 Jun 2010 06:22
Forum: DOS Batch Forum
Topic: Moving Files to seperate folder using a .BAT
Replies: 13
Views: 4139

Re: Moving Files to seperate folder using a .BAT

This should be easy to do, but tell us a bit more about the folder structure: Where are the files placed and where are the destination folders placed?

Regards
aGerman
by aGerman
28 Jun 2010 16:19
Forum: DOS Batch Forum
Topic: Need some help with explanation
Replies: 5
Views: 2850

Re: Need some help with explanation

Well, I mostly enclose variable name and value in double quotes. This has a lot of advantages. copy&paste: @echo off &setlocal set "a=x" & set b=y & echo test: echo %a%! echo %b%! pause set "a=^>" set b=^> echo %a% pause echo %b% pause The first half shows you the...
by aGerman
28 Jun 2010 15:45
Forum: DOS Batch Forum
Topic: How to replace special characters...
Replies: 4
Views: 5794

Re: How to replace special characters...

Well, to process html code using batch is never a good idea. In case the number of quotes before the URL is always the same, you could work with this quotes to separate the URL from the whole waste before and after. Try this @echo off &setlocal for /f "delims=" %%a in (tmp.tmp) do ( se...