Search found 128 matches
- 17 Mar 2018 03:48
- Forum: DOS Batch Forum
- Topic: Mask password with Asterisk
- Replies: 11
- Views: 21787
Re: Mask password with Asterisk
Also, if using powershell is allowed @echo off SetLocal EnableDelayedExpansion EnableExtensions set/P user="* User: " call:getPass pass echo %user% %pass% EndLocal exit/B 1 :getPass SetLocal set "psCmd=powershell -Command "$pwd = read-host '* Password' -AsSecureString; $BSTR=[System.Runtime.InteropS...
- 14 Mar 2018 03:30
- Forum: DOS Batch Forum
- Topic: Is any way to insert blank lines in the text file?
- Replies: 4
- Views: 4514
Re: Is any way to insert blank lines in the text file?
supposed lines doesn't start with [ nor ] this should work for /F "tokens=1,* delims=[]" %%i in ('"type "%textfile%"|find /N /V """') do ( echo(%%j ) but, as you are doing string substitutions >"%newfile%" ( for /F "tokens=1,* delims=[]" %%i in ('"type "%textfile%"|find /N /V """') do ( set "line=%%...
- 12 Mar 2018 07:33
- Forum: DOS Batch Forum
- Topic: How to create links in automatic?
- Replies: 8
- Views: 7808
Re: How to create links in automatic?
the new link will overwrite the existing one (if you have enough permissions) see http://www.tek-tips.com/viewthread.cfm?qid=850335
- 12 Mar 2018 04:48
- Forum: DOS Batch Forum
- Topic: How to create links in automatic?
- Replies: 8
- Views: 7808
Re: How to create links in automatic?
as a starting point here is a script that uses vbs to create links. you only need to tell createShortut the real data @ echo off SetLocal EnableDelayedExpansion EnableExtensions set "target=" & rem put here your real file (if empty this script will be used) set "description=" & rem put link descript...
- 04 Mar 2018 07:58
- Forum: DOS Batch Forum
- Topic: Combine Text Searches / Strings to a specified .cvs format
- Replies: 6
- Views: 6423
Re: Combine Text Searches / Strings to a specified .cvs format
@Antonio, I began with a script similar to yours, copying the contents of the test1.txt text file . Then I downloaded the test1.zip to test it against the real data. This file contains 146 IDs to parse, and (at least on my computer) notepad can't show 146 columns, it wraps lines, so result was a mes...
- 04 Mar 2018 07:45
- Forum: DOS Batch Forum
- Topic: Fastest copy for multiple gigs?
- Replies: 6
- Views: 5720
Re: Fastest copy for multiple gigs?
Are you running it from task shedule r? If the answer is no, skip this post. If yes, I've faced the same copying up a database of 3Gb from NAS Storage to an alternative server to perform a RESTORE over it. Both systems are Windows Server 2008R2. Either XCOPY or ROBOCOPY take more than an hour to cop...
- 03 Mar 2018 16:36
- Forum: DOS Batch Forum
- Topic: Combine Text Searches / Strings to a specified .cvs format
- Replies: 6
- Views: 6423
- 03 Mar 2018 11:42
- Forum: DOS Batch Forum
- Topic: Combine Text Searches / Strings to a specified .cvs format
- Replies: 6
- Views: 6423
Re: Combine Text Searches / Strings to a specified .cvs format
for /f "tokens=7*" %a in ('findstr /c:"NIST SP 800-53 Revision 4 ::" test1.txt') do @echo %a %b for /f "tokens=9*" %a in ('findstr /c:"Vuln ID:" test1.txt') do @echo %a Hello DosTips, ... let findstr find the data. any time an id is found is stored in a var named ID[index] , where index , will be 1...
- 27 Feb 2018 14:08
- Forum: DOS Batch Forum
- Topic: Counter with batch
- Replies: 5
- Views: 5062
Re: Counter with batch
Good catch! I totally miss that!pieh-ejdsch wrote: ↑27 Feb 2018 10:26will create a varName like "a Counter" with Content is 0Code: Select all
set a Counter=0
- 26 Feb 2018 15:22
- Forum: DOS Batch Forum
- Topic: Counter with batch
- Replies: 5
- Views: 5062
Re: Counter with batch
only a note is best practice. you don't need any expansion with set /a, and you can make one line calculations .
this is always evaluated left to right, so the left variable reflects the new value of the right one
Code: Select all
set /a COUNTER+=1
Code: Select all
set /a counter+=1, test=counter%%3, …
this is always evaluated left to right, so the left variable reflects the new value of the right one
- 07 Feb 2018 09:23
- Forum: DOS Batch Forum
- Topic: Want to read a text file and do copy of the Files
- Replies: 5
- Views: 5682
Re: Want to read a text file and do copy of the Files
be sure two write UNC paths within quotes when using xcopy. or better use robocopy
- 07 Feb 2018 04:52
- Forum: DOS Batch Forum
- Topic: Want to read a text file and do copy of the Files
- Replies: 5
- Views: 5682
Re: Want to read a text file and do copy of the Files
Percent expansion is done before a code block is executed. you have set delayed expansion, but you are not using it.
change to
change
Code: Select all
if NOT %errorlevel%==0 ( whatever )
Code: Select all
if !errorlevel! neq 0 ( whatever )
- 30 Jan 2018 10:50
- Forum: DOS Batch Forum
- Topic: run scripts on Windows 7 and Windows server 2012 R2
- Replies: 4
- Views: 4086
- 13 Jan 2018 05:05
- Forum: DOS Batch Forum
- Topic: removing dates from filenames
- Replies: 8
- Views: 7084
Re: removing dates from filenames
Simply add full paths to exe, source and destination files. give this a try (NOT TESTED) @echo off :: %~dp0 is the directory this script is run from, so change :: set "pdftotext=%~dp0pdftotext.exe" to whatever the actual location is (i.e) :: set "pdftotext=C:\Program Files (x86)\xpdf\pdftotext.exe" ...
- 11 Jan 2018 03:27
- Forum: DOS Batch Forum
- Topic: removing dates from filenames
- Replies: 8
- Views: 7084
Re: removing dates from filenames
if date is always 21 characters long (as in your example) smply remove the last 22 (date length + hyphen) characters from filename @echo off setlocal enableDelayedExpansion set /a dateLen=22 for /f %%v in ('dir /b') do ( set "file=%%~nv" & rem fetch filename only set "file=!file:~0,-%dateLen%!%%~xv"...