Search found 115 matches

by tinfanide
18 Sep 2019 03:07
Forum: DOS Batch Forum
Topic: How to search for files with file names listed in a text file (DIR)?
Replies: 1
Views: 1739

How to search for files with file names listed in a text file (DIR)?

A text file named 'source.txt' containing the file names to be searched for:

a.txt
b.txt
c.txt

I'd like to use 'DIR /B /S' command by referring to 'source.txt' to search for those files and copy those files to a new folder called 'destination'. Could anyone show me how to do that, please? Thank you!
by tinfanide
21 Jan 2013 01:48
Forum: DOS Batch Forum
Topic: AT commands: why does it not work?
Replies: 6
Views: 2437

Re: AT commands: why does it not work?

Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Windows\system32>at 15:47 /interactive "echo hi &pause" Warning: Due to security enhancements, this task will run at the time expected but not interactively. Use schtasks.exe utility...
by tinfanide
15 Jan 2013 06:05
Forum: DOS Batch Forum
Topic: AT commands: why does it not work?
Replies: 6
Views: 2437

AT commands: why does it not work?

Code: Select all

at 00:00 /interactive "echo hi"

Why does it not work?

But if:

Code: Select all

at 00:00 "cmd /c echo something > C:\something.txt"

It works.
by tinfanide
31 Oct 2012 06:00
Forum: DOS Batch Forum
Topic: String Substitution: replace at one go & particular letters?
Replies: 3
Views: 1565

Re: String Substitution: replace at one go & particular lett

Note that the R in "* R *" is the replace of the " s " before the numbers. you can change it to any thing else. The starts * is to match the pattern of the file name, it till the command to rename the files with the same strings and when it comes to the first string after the fi...
by tinfanide
28 Oct 2012 06:47
Forum: DOS Batch Forum
Topic: String Substitution: replace at one go & particular letters?
Replies: 3
Views: 1565

String Substitution: replace at one go & particular letters?

@ECHO ON SETLOCAL ENABLEDELAYEDEXPANSION FOR /F "tokens=*" %%A IN ('DIR /S /B') DO ( IF NOT %%~xA==.bat ( SET "old=%%A" SET "new=%%A" SET new=!new:s=S! SET new=!new:SFile=sFile! MOVE "!old!" "!new!" ) ) PAUSE>NUL I wonder how I can 1. replace all th...
by tinfanide
07 Aug 2012 22:10
Forum: DOS Batch Forum
Topic: REG EXPORT REG QUERY???
Replies: 2
Views: 1280

REG EXPORT REG QUERY???

Suppose I've extracted the wanted registry keys: @ECHO OFF REG QUERY HKLM /s /v WakeEnabled The output: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{36FC9E60-C465-11CF-8056-444553540000}\0009 WakeEnabled REG_DWORD 0x0 HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{36FC9E60-C465-11C...
by tinfanide
05 Aug 2012 12:25
Forum: DOS Batch Forum
Topic: Access is denied.: how to modify APPDATA file?
Replies: 2
Views: 1224

Re: Access is denied.: how to modify APPDATA file?

Just found why the message was shown. ATTRIB -H %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini ECHO.>%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini ATTRIB +H %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini After realising the file is h...
by tinfanide
05 Aug 2012 12:09
Forum: DOS Batch Forum
Topic: Access is denied.: how to modify APPDATA file?
Replies: 2
Views: 1224

Access is denied.: how to modify APPDATA file?

ECHO.>%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini I would like to use batch scripts to modify the slideshow.ini file. Yet it returns: Access is denied. It's okay, though, to read the file with notepad.exe %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Themes\slideshow.ini
by tinfanide
14 May 2012 06:15
Forum: DOS Batch Forum
Topic: FOR /F loop text files: why blank lines are skipped?
Replies: 5
Views: 1918

Re: FOR /F loop text files: why blank lines are skipped?

Because that's the way FOR /F works Try: ... FOR /F "tokens=1* delims=:" %%A IN ('FINDSTR /N "^" "5.txt"') DO ( ... ECHO %%B - !str! ... Regards aGerman EDIT: To avoid faults with leading colons: ... FOR /F "delims=" %%A IN ('FINDSTR /N "^" "5....
by tinfanide
13 May 2012 05:40
Forum: DOS Batch Forum
Topic: FOR /F loop text files: why blank lines are skipped?
Replies: 5
Views: 1918

FOR /F loop text files: why blank lines are skipped?

Code: Select all

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

< 6.txt (
   FOR /F "delims=" %%A IN (5.txt) DO (
      SET str=
      SET /P str=

      
      ECHO %%A - !str!
   )
)

PAUSE


5.txt
a

b
c


6.txt
a

d
e


a - a
b -
c - d
Press any key to continue . . .
by tinfanide
12 May 2012 23:29
Forum: DOS Batch Forum
Topic: REG EXPORT: Hex returned?
Replies: 1
Views: 2268

REG EXPORT: Hex returned?

REM Win7 64-bit REM real path REG EXPORT "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" REM Hex path REG EXPORT "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" On my machine, both registry keys conta...
by tinfanide
12 May 2012 08:26
Forum: DOS Batch Forum
Topic: Can't explain the error!
Replies: 8
Views: 1790

Re: Can't explain the error!

Comparing !word1! with !word2!, I am wondering why SET "word1=" IF NOT DEFINED word1 SET "word1=%%A" Only SET the variable = the first line (after skipping the precedent line)? I omit SET "word2=" IF NOT DEFINED word 2 SET "word2=%%B" and it takes the last li...
by tinfanide
10 May 2012 23:51
Forum: DOS Batch Forum
Topic: Can't explain the error!
Replies: 8
Views: 1790

Re: Can't explain the error!

@ECHO ON setlocal enableDelayedExpansion FOR /L %%N IN (0,1,2) DO ( set skip=%%N set "word1=" REM set "word2=" FOR /F "tokens=*" %%A IN ('MORE +!skip! 1.txt') DO IF NOT DEFINED word1 SET "word1=%%A" ECHO !word1! FOR /F "tokens=*" %%B IN ('MORE +!ski...
by tinfanide
10 May 2012 09:18
Forum: DOS Batch Forum
Topic: Can't explain the error!
Replies: 8
Views: 1790

Re: Can't explain the error!

Try enabling delayed expansion and enclose the variables in quotes or brackets. @ECHO OFF setlocal enableDelayedExpansion FOR /L %%N IN (0,1,2) DO ( FOR /F "tokens=*" %%A IN ('MORE +%%N 1.txt') DO SET "word1=%%A"&GOTO :next :next FOR /F "tokens=*" %%B IN ('MORE +%%...