Search found 117 matches

by tinfanide
08 Nov 2022 03:40
Forum: DOS Batch Forum
Topic: Passing arguments to a subroutine
Replies: 4
Views: 4077

Re: Passing arguments to a subroutine

Your guess is right. The repeated double quotes break it. The password is a letter password, with no special characters though. Thank you all.
by tinfanide
06 Nov 2022 01:03
Forum: DOS Batch Forum
Topic: Passing arguments to a subroutine
Replies: 4
Views: 4077

Passing arguments to a subroutine

How can I fix code snippet A? Thanks! Code snippet A This does not work: SET pwd=mypassword SET files_path=C:\Users\User\Downloads\_bat testing\*.pdf SET qpdf_path=C:\Program Files\qpdf 11.1.1\bin\qpdf.exe for %%G in ("%files_path%") do (CALL :subroutine "%qpdf_path%" %pwd% "%%G") :subroutine %1 --d...
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: 6681

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: 6399

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: 6399

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: 4000

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: 4000

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: 3374

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: 3351

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: 3351

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: 5483

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: 5483

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: 4077

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: 6551

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...