Search found 4506 matches

by aGerman
18 Oct 2010 11:42
Forum: DOS Batch Forum
Topic: handle command line parameters %1, %2, %3, %4 ....
Replies: 1
Views: 2773

Re: handle command line parameters %1, %2, %3, %4 ....

Try this example: @echo off &setlocal :loop if "%~1"=="" goto exitLoop set "option=%~1" set "%option:~1%param=%option% %~2" shift shift goto loop :exitLoop set "host=www.dostips.com" if defined Aparam set "Aparam=-A %host%" :: only to s...
by aGerman
18 Oct 2010 11:11
Forum: DOS Batch Forum
Topic: batch file issue for Dbf to csv
Replies: 13
Views: 13596

Re: batch file issue for Dbf to csv

Probably another event for ghostmachine4's gawk A native batch solution could look like this @echo off &setlocal >"C_N_DETL.csv" type nul for /f "tokens=* delims=1234567890" %%a in ('findstr /n "^" "C_N_DETL.DBF"') do ( set "line=%%a" call :proc ...
by aGerman
18 Oct 2010 10:35
Forum: DOS Batch Forum
Topic: Reg Query - return all values from a registry key
Replies: 4
Views: 51525

Re: Reg Query - return all values from a registry key

OK, have a look at these two lines: for /f "tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" /v "MIS" 2^>nul') do set "MIS=%%b" for /f "tokens=2*" %%a in ('reg query "HKLM\SOFTWARE\Microsoft\Microso...
by aGerman
17 Oct 2010 17:06
Forum: DOS Batch Forum
Topic: add text string to a text file
Replies: 14
Views: 10242

Re: add text string to a text file

No prob. :: NUM.BAT Usage NUM Pre File_IN [/i] > File_OUT @echo off set "Pre=%~1" for /F "tokens=1* delims=[]" %%a in ('find /V /N "" ^< %2') do ( set "line=%%b" call :proc %%a %3 ) goto :eof :proc setlocal enabledelayedexpansion if /i "%~2"=="/...
by aGerman
17 Oct 2010 16:34
Forum: DOS Batch Forum
Topic: add text string to a text file
Replies: 14
Views: 10242

Re: add text string to a text file

Of course, you're right !k. But there is a simple solution. :: NUM.BAT Usage NUM Pre File_IN > File_OUT @echo off set "Pre=%~1" for /F "tokens=1* delims=[]" %%a in ('find /V /N "" ^< %2') do ( set "line=%%b" call :proc %%a ) goto :eof :proc setlocal enabledela...
by aGerman
17 Oct 2010 15:46
Forum: DOS Batch Forum
Topic: add text string to a text file
Replies: 14
Views: 10242

Re: add text string to a text file

Not that hard, !k. :: NUM.BAT Usage: NUM Pre File_IN > File_OUT @echo off &setlocal enabledelayedexpansion set "Pre=%~1" for /F "tokens=1* delims=[]" %%a in ('find /V /N "" ^< %2') do ( echo\!Pre!%%a:%%b ) :: End_Of_batch Try Call NUM.bat "a&b" File_IN...
by aGerman
17 Oct 2010 13:49
Forum: DOS Batch Forum
Topic: Batch Encryption (help)
Replies: 6
Views: 7379

Re: Batch Encryption (help)

Well aPinoy, for me your batch code seems absolutely OK. It depends on what you wanna do. BTW jeb is much better with those experimental stuff than me. Here you will find a similar theme. Never fear to share this here. Don't get me wrong but no credible programmer would ever use batch (or any other ...
by aGerman
16 Oct 2010 17:07
Forum: DOS Batch Forum
Topic: Batch Encryption (help)
Replies: 6
Views: 7379

Re: Batch Encryption (help)

Interesting batch file. Well, your intention was to get an encryption but this is not realy an encryption, it's an algorithm to create a special combination of letters. What I mean is if you want to let the batch file write "Yes my birthday is in january" you would need a completely new al...
by aGerman
16 Oct 2010 07:17
Forum: DOS Batch Forum
Topic: How to assign fix drive letter in batch file? (SOLVED)
Replies: 2
Views: 4205

Re: How to assign fix drive letter in batch file?

To different things: 1st) If you have to work on your pen drive you don't need the drive letter. Use relative pathes. Eg.: instead of F:\data\xyz.exe you could use \data\xyz.exe as well. If you have a batch file on your pen drive, you will find the drive letter in %~d0 2nd) If you work on the local ...
by aGerman
16 Oct 2010 06:53
Forum: DOS Batch Forum
Topic: Reg Query - return all values from a registry key
Replies: 4
Views: 51525

Re: Reg Query - return all values from a registry key

Sry but I don't get it. To get the entire content (including sub keys and all the recursive values) you could write. >reg.txt reg query "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL" /s But what exactly should come to three different text files? Maybe you could post the ...
by aGerman
16 Oct 2010 06:41
Forum: DOS Batch Forum
Topic: Remove prompt from output
Replies: 4
Views: 4317

Re: Remove prompt from output

!k is right. The PROMPT command is able to change it.
Try
prompt $
to disable the prompt and write
prompt
to return to your default prompt.

Regards
aGerman
by aGerman
16 Oct 2010 06:34
Forum: DOS Batch Forum
Topic: Install only if it wasnt installed before
Replies: 1
Views: 2722

Re: Install only if it wasnt installed before

The question is how you could determine if you have installed it before? Is there a file or folder created that only exists if it is installed? Or is there a registry key we could look for?

Regards
aGerman
by aGerman
11 Oct 2010 08:21
Forum: DOS Batch Forum
Topic: updating a folder
Replies: 7
Views: 6733

Re: updating a folder

CMD is unable to compare DateTime values directly. Thats why you have to separate the single values for day, month, year, hour and minute and reassemble these values to a timestamp with the following formatting yyyymmddHHMM These timestamps for the same file on your flash drive and on the hard drive...
by aGerman
09 Oct 2010 15:50
Forum: DOS Batch Forum
Topic: updating a folder
Replies: 7
Views: 6733

Re: updating a folder

Sorry for the bad english.. It's probably better than my English. OK. Thought about it and maybe this would work. For my example the USB folder is D:\Folder and the local folder is C:\Folder . @echo off &setlocal for %%a in (D:\Folder\*.*) do call :procFile "%%~a" "%%~ta" pa...
by aGerman
08 Oct 2010 15:21
Forum: DOS Batch Forum
Topic: Assistance required with Advanced SET syntax
Replies: 8
Views: 7963

Re: Assistance required with Advanced SET syntax

Quite simply, I want to be able to strip away all but the last 3 characters of an environment variable. So for example value=12345, would be changed to 345. It is not sufficient to simply delete the first 2 characters from the beginning because the variable length may not always be 5 characters. So...