Search found 1668 matches

by penpen
18 Jul 2019 15:59
Forum: DOS Batch Forum
Topic: Find the directory path in batch
Replies: 1
Views: 31

Re: Find the directory path in batch

External dos commands like "findstr.exe" typically aren't able to open a file using an URI; also most probable encoded URI's are also unsupported. You have to map a network drive to a local volume like for example "Z:", using "net.exe" (and after you have finished your work, unmap it): :map network ...
by penpen
18 Jul 2019 15:41
Forum: DOS Batch Forum
Topic: Display folder contents to user and allow them to pick
Replies: 3
Views: 74

Re: Display folder contents to user and allow them to pick

If i understand your code and task right, then just add that echo before the pause command (and put an goto :eof behind pause to not falsely entering the :process part of your batch).

Code: Select all

echo(Your choice is: !$_%SELECTION%!
pause
goto :eof
penpen
by penpen
11 Jul 2019 03:40
Forum: DOS Batch Forum
Topic: copy file
Replies: 3
Views: 164

Re: copy file

I hope this "slightly" changed batch does the trick (untested): @echo off setlocal enableExtensions disableDelayedExpansion set "filter=*.bat" set "workDir=." set "sourceDir=source" set "targetDir=target" set "logDir=logs" set "logFile=%logDir%\LogFile %date% %time::=%.txt" set "answerFile=%workDir%...
by penpen
09 Jul 2019 08:42
Forum: DOS Batch Forum
Topic: batch to rename dir / sudir and files
Replies: 3
Views: 175

Re: batch to rename dir / sudir and files

nmareis wrote:but this do not renames the directories and the subdirectories
You are using the command "dir /a-d/b" whose command line argument "/a-d" excludes all directories:
So you might want to use "dir /b" instead (for all instances of "dir /a-d/b" in your source).

penpen
by penpen
09 Jul 2019 08:29
Forum: DOS Batch Forum
Topic: copy file
Replies: 3
Views: 164

Re: copy file

This (untested) code sniplet might help you:

Code: Select all

@echo off
setlocal enableExtensions disableDelayedExpansion
>"logs\LogFile %date% %time::=%.txt" copy /Y "source\*.bat" "target"
Sidenote: You might want to change the used directories.

penpen
by penpen
09 Jul 2019 08:13
Forum: DOS Batch Forum
Topic: Windows activation command line
Replies: 2
Views: 161

Re: Windows activation command line

Depending on what your goal is "slmgr.vbs" may help you:
https://ss64.com/nt/slmgr.html


penpen
by penpen
09 Jul 2019 07:57
Forum: DOS Batch Forum
Topic: Months SCHTASKS
Replies: 2
Views: 171

Re: Months SCHTASKS

I am not that familiar with schtask, but i assume you could use the "/m"-argument:
https://docs.microsoft.com/en-us/window ... KMK_months

penpen
by penpen
08 Jul 2019 11:23
Forum: DOS Batch Forum
Topic: Extract Subject details from certificate in Batch script
Replies: 1
Views: 353

Re: Extract Subject details from certificate in Batch script

I'm unsire if you could use a "for/f"-loop to extract that information (depends on the exact the output of your comnmand).
Could you provide a sample output (with alienated data)?

penpen
by penpen
08 Jul 2019 11:14
Forum: DOS Batch Forum
Topic: jTimestamp.bat date/time utility v2.1 - Replacement for getTimestamp.bat
Replies: 20
Views: 7026

Re: jTimestamp.bat date/time utility v2.1 - Replacement for getTimestamp.bat

You could use a "for/f"-loop to store that value into an environment variable: @echo off setlocal enableExtensions disableDelayedExpansion for /f %%a in ('jTimestamp /F "{ISOWK}"') do set "isoWk=%%~a" set isoWk goto :eof Sidenote: You should be aware, that some years have 53 weeks (more specific: ev...
by penpen
08 Jul 2019 10:53
Forum: DOS Batch Forum
Topic: Find and replace multiple words in files
Replies: 1
Views: 204

Re: Find and replace multiple words in files

If you only want to get rid of the "echo"'s in the output, then you just could use: @echo off cls REM -- Prepare the Command Processor -- SETLOCAL ENABLEEXTENSIONS SETLOCAL DISABLEDELAYEDEXPANSION ::BatchSubstitude - parses a File line by line and replaces a substring" ::syntax: BatchSubstitude.bat ...
by penpen
21 Jun 2019 19:08
Forum: DOS Batch Forum
Topic: send email via batch
Replies: 3
Views: 560

Re: send email via batch

The following might help you (although there is no MS Outlook involved):
viewtopic.php?f=3&t=3566

penpen
by penpen
14 Jun 2019 07:10
Forum: DOS Batch Forum
Topic: Strange double syntax error
Replies: 2
Views: 580

Re: Strange double syntax error

(Edit: Too slow.) I always get the same error message in all your cases (using win 10, x64 home; cmd shell says Version 10.0.17134.829)! "=WRONG SYNTAX%" kann syntaktisch an dieser Stelle nicht verarbeitet werden. Syntaxfehler. But why I show these observations :!: Because, I hope to find a way to e...
by penpen
13 Jun 2019 18:19
Forum: DOS Batch Forum
Topic: Examination of Linefeeds with CALL
Replies: 18
Views: 4076

Re: Examination of Linefeeds with CALL

Somehow i can't memorize the parser rules for long - so i have to familiarize myself with that topic (again), so it might take a while. But wouldn't rule 1.05 mean that the "def"-part in the following batch file should be dropped (which doesn't happen)? "test.bat" @echo off setlocal (set \n=^ %=empt...
by penpen
10 Jun 2019 16:25
Forum: DOS Batch Forum
Topic: Copying a file from a folder with today's date to another folder.
Replies: 2
Views: 631

Re: Copying a file from a folder with today's date to another folder.

You could just use the copy command with the /y-switch (to overwrite the target file without prompting), and use the date environment variable inside a for/f-loop to build the source name. Due to the fact that the date is localized you may have to modify that code , so the following hopefully may he...
by penpen
29 May 2019 17:10
Forum: DOS Batch Forum
Topic: Text Files - Coloured Characters
Replies: 6
Views: 1024

Re: Text Files - Coloured Characters

You could use vt100 codes which are virtual terminal sequences: https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences Example: https://www.dostips.com/forum/viewtopic.php?f=3&t=8044 You might also want to read the folowing: https://www.dostips.com/forum/viewtopic.php?f=...