Search found 244 matches

by Endoro
27 May 2013 05:22
Forum: DOS Batch Forum
Topic: How-to hide error output from Reg Query command?
Replies: 7
Views: 8435

Re: How-to hide error output from Reg Query command?

your code works for me, eg. on the command line:

Code: Select all

for /f "tokens=* delims= " %a in (del.txt) do @reg delete "%a" /f > nul 2>&1
No message, no error message. Turn "echo on" to see, what happens.
by Endoro
27 May 2013 05:00
Forum: DOS Batch Forum
Topic: If Date not equal to today then run a command??
Replies: 4
Views: 2890

Re: If Date not equal to today then run a command??

try it with double quotes:

Code: Select all

do set "currentserverdate=%%a" & ....
by Endoro
27 May 2013 03:54
Forum: DOS Batch Forum
Topic: If Date not equal to today then run a command??
Replies: 4
Views: 2890

Re: If Date not equal to today then run a command??

you can try this:

Code: Select all

for /f "tokens=2" %%i in ("%date%") do set "cdate=%%i"
echo %cdate%
by Endoro
26 May 2013 23:23
Forum: DOS Batch Forum
Topic: Need help updating file location path...
Replies: 2
Views: 1438

Re: Need help updating file location path...

Any ideas??? try this: @echo off&setlocal for %%i in ( scrfaxp5 scrfaxp6 scrfaxp8 srrfaxp5 srrfaxp6 srrfaxp8 ) do ( echo "Verifying services..." echo. echo "%%i" echo "RightFax Database Module" & sc \\%%i query RFDB|findstr STATE & echo. echo "RightFax...
by Endoro
24 May 2013 08:43
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14147

Re: create folders from a list and move files

I stopped counting ID's after your posting here : I think my original query was to get every extension found in a folder and display and not limit it to a fixed few. So if you suddenly need ID counting again, please use my previous code. Yes, this has to be modifyed: for /f "usebackqtokens=1,2&...
by Endoro
24 May 2013 00:08
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14147

Re: create folders from a list and move files

hi Endoro, Though i still fail to understand what SET "." means or does, i have got the code working by changing a few things. for e.g. the %targetfolder% was not specified while making the directories. i also eliminated the linefeeds between each statements and also removed wrap text so ...
by Endoro
23 May 2013 23:00
Forum: DOS Batch Forum
Topic: Leading Spaces Batch File
Replies: 9
Views: 7210

Re: Leading Spaces Batch File

I tested this with XP:

Code: Select all

C:\TEST>type test.cmd
@echo off
echo|set /p=>con
echo(some text
C:\TEST>test
 some text

C:\TEST>


There is a leading space before "some text". Does this work with Vista and later too?
by Endoro
23 May 2013 15:11
Forum: DOS Batch Forum
Topic: Leading Spaces Batch File
Replies: 9
Views: 7210

Re: Leading Spaces Batch File

try this:

Code: Select all

@ECHO OFF
Cls
<nul set /p"=You have the following fruit ">>"Output.txt"
for /F %%a in (fruit.txt) do (
<nul set /p"=%%a">>"Output.txt"
<nul set /p"=,">>"Output.txt"
)

by Endoro
23 May 2013 14:59
Forum: DOS Batch Forum
Topic: write variable to log file
Replies: 4
Views: 1926

Re: write variable to log file

it seems, %%a is not the key, it's part of the path. Example: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4} AuthorizedCDFPrefix REG_SZ Comments REG_SZ Contact REG_SZ DisplayVersion REG_SZ 9.0.21022 HelpLink REG_SZ HelpTeleph...
by Endoro
23 May 2013 10:29
Forum: DOS Batch Forum
Topic: write variable to log file
Replies: 4
Views: 1926

Re: write variable to log file

try this:

Code: Select all

) DO (
REG QUERY HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall /v %%a 1>nul 2>nul && (
>>c:\temp\JavaUninstall.txt echo(%%a
start /wait MsiExec.exe /qn /x %%a
)
)
by Endoro
23 May 2013 10:24
Forum: DOS Batch Forum
Topic: create folders from a list and move files
Replies: 49
Views: 14147

Re: create folders from a list and move files

Hi, set "." >nul 2>&1 || (echo(no files from "%ClassID_ID_List%" found in "%startfolder%"&goto:eof) check for files and print an error message, if no files found. After the termination of the script the environment variables also terminate. You get "Environ...
by Endoro
23 May 2013 07:58
Forum: DOS Batch Forum
Topic: Rename a file
Replies: 1
Views: 1188

Re: Rename a file

what you show is the 6th underscore from left. <----there is the left side, on the beginning. @echo off&setlocal set "name=114721_1731681_GHYTRH_Rebook_Linz_HYTRFHJ_3427238_052113" for /f "tokens=1-6*delims=_" %%a in ("%name%") do set "newname=%%a_%%b_%%c_%%d_%...
by Endoro
22 May 2013 23:39
Forum: DOS Batch Forum
Topic: Splitting a text file based upon another file
Replies: 23
Views: 5733

Re: Splitting a text file based upon another file

your solution will incorrectly insert this line in the first file if the number list contain 002709. No, I tested it and it works. There is only one column with six digits and one leading and one trailing space. My code does obviously not work, if there are <tab>s around the column. But I can fix i...
by Endoro
22 May 2013 16:05
Forum: DOS Batch Forum
Topic: Splitting a text file based upon another file
Replies: 23
Views: 5733

Re: Splitting a text file based upon another file

next try with "findstr": @echo off&setlocal set "ffile=file.txt" set "fsearch=search.txt" set "ftemp=%temp%\%random%.tmp" (for /f usebackq %%i in ("%fsearch%") do echo( %%i )>"%ftemp%" findstr /lg:"%ftemp%" "%ffile%"...
by Endoro
22 May 2013 10:33
Forum: DOS Batch Forum
Topic: Splitting a text file based upon another file
Replies: 23
Views: 5733

Re: Splitting a text file based upon another file

and with "findstr": @echo off&setlocal set "file=file.txt" set "fsearch=search.txt" del "%file%.new?" 2>NUL for /f "usebackqtokens=1-7*" %%i in ("%file%") do findstr /l "%%o" "%fsearch%" >nul && ( echo %%i %%...