Search found 1970 matches

by penpen
21 Jul 2013 14:00
Forum: DOS Batch Forum
Topic: password protect
Replies: 5
Views: 5537

Re: password protect

Even in MS_DOS 6.22 days this was not a safe way. If you want to see, what is inside you just have to use dir and xcopy. Lets assume you are in parent directory of the alt-char named folder, TEST is an unused filename, and A is part of this alt-char named folder (verified using dir), then this is a ...
by penpen
21 Jul 2013 12:54
Forum: DOS Batch Forum
Topic: RAID 1.3 via DOS?
Replies: 18
Views: 14636

Re: RAID 1.3 via DOS?

It is not recommended to do that using batch... . If you want a fast and secure way to do this i recommend you to learn c++ or something similar and some little bit about CRC32 and MD5. If you do that you are able to detect even small parts of files that had been corrupted. Also you need to read muc...
by penpen
21 Jul 2013 12:31
Forum: DOS Batch Forum
Topic: Study about moving the cursor up
Replies: 18
Views: 20830

Re: Study about moving the cursor up

I fear it is not possible to send special keys via pipe using the cmd shell, or command.com environment. If nothing important was changed since MS-DOS 6.22, piped bytes with value 0x00 will be interpreted by set /p as an end of line. I assume nothing changed, because <nul set /p "=." still...
by penpen
20 Jul 2013 16:48
Forum: DOS Batch Forum
Topic: batch file to search and copy particular file
Replies: 13
Views: 12843

Re: batch file to search and copy particular file

I had built in some errors, sry. :oops:
I have corrected the code above, hopefully it works now.

penpen
by penpen
20 Jul 2013 12:08
Forum: DOS Batch Forum
Topic: need help of hybrid jscript from vb DateLastModified
Replies: 9
Views: 10733

Re: need help of hybrid jscript from vb DateLastModified

There are some errors. Here is a fixed version: @if (@X)==(@Y) @end /* harmless hybrid line that begins a JScrpt comment ::: Batch part :::: @echo off cscript //nologo //e:JScript "%~f0" %* exit /b *** JScript part ***/ var fso = new ActiveXObject("Scripting.FileSystemObject"); v...
by penpen
20 Jul 2013 11:17
Forum: DOS Batch Forum
Topic: batch file to search and copy particular file
Replies: 13
Views: 12843

Re: batch file to search and copy particular file

The full code (Samir's algorithm), if robocopy could not be installed to the system you use: :main @echo off setlocal :: detect usb stick on assumtion: this batch is started from it. set "usbVolume=%~d0" set "usbVolume=%usbVolume:~0,1%" set "targetDirectory=\targetDirectory&...
by penpen
19 Jul 2013 08:54
Forum: DOS Batch Forum
Topic: batch file to search and copy particular file
Replies: 13
Views: 12843

Re: batch file to search and copy particular file

I have not much time today (sry), so here only a little bit code to get all connected volumes to search for. Maybe wou want to remove some volumes, this can be done easiliy. See the example in the code: :main setlocal call :getConnectedVolumes connectedVolumes echo connectedVolumes: %connectedVolume...
by penpen
17 Jul 2013 14:17
Forum: DOS Batch Forum
Topic: Merge .txt files in folders, adding commas and quotationmark
Replies: 8
Views: 7855

Re: Merge .txt files in folders, adding commas and quotation

I have renamed the test text file batman.txt to -åäö.txt and got no errors on execution on XP home and Win7 home, so i cannot fix it. The only problem i got is with the ampersand (&). I fixed it, maybe this helps you, too: @echo off cls setlocal set "combined=combined.txt" ( for %%a in...
by penpen
17 Jul 2013 08:24
Forum: DOS Batch Forum
Topic: Why no time in TIME.TXT :- echo %time% > TIME.TXT > NUL
Replies: 5
Views: 5758

Re: Why no time in TIME.TXT :- echo %time% > TIME.TXT > NUL

I thought, I have tested that,... but i only tricked myself out when verifying it: Z:>echo hallo > aaaaaaaaaaaaaaaa512times_or_more:?* >> test.txt Z:>type test.txt Der Befehl "set"test=hallo"" ist entweder falsch geschrieben oder konnte nicht gefunden werden. But the content of t...
by penpen
17 Jul 2013 06:12
Forum: DOS Batch Forum
Topic: Why no time in TIME.TXT :- echo %time% > TIME.TXT > NUL
Replies: 5
Views: 5758

Re: Why no time in TIME.TXT :- echo %time% > TIME.TXT > NUL

Case 1: echo %time% > filename > NUL The command processor (CP) executes this atomic expression: At first it redirects the streams by handles, and then executes the command. So if no error occurs the CP: 1. redirects the standard output stream (STDOUT) to a FileOutputStream (filename) (Wrong: See je...
by penpen
17 Jul 2013 04:54
Forum: DOS Batch Forum
Topic: Run Batch File at Specific Time
Replies: 7
Views: 9512

Re: Run Batch File at Specific Time

Normally i using the executables without the path prior to it, too, but i then add the following at the beginning of a batch file and run it: @echo off setlocal for /f "tokens=2* delims=:" %%a in ('%SystemRoot%\system32\find /C "#" "%~f0"') do set /a "lines=%%b&quo...
by penpen
17 Jul 2013 01:19
Forum: DOS Batch Forum
Topic: Run Batch File at Specific Time
Replies: 7
Views: 9512

Re: Run Batch File at Specific Time

Definitely that.
If you don't exactly specify which executable to run, someone may execute his exe file instead of yours, with your rights as you call it.
by penpen
17 Jul 2013 00:55
Forum: DOS Batch Forum
Topic: A different method to trim spaces from a string
Replies: 16
Views: 19240

Re: A different method to trim spaces from a string

@probyn I've found an issue when executing: Z:\>SET TEST= test Z:\>SET TEST_A= test a Z:\>safeTrim TEST Z:\>SET TEST TEST=test a TEST_A= test a This could be fixed by adding a safe if "%1" == "TEST", also a %1 gatekeeper should be performed, so the whole code changes to: @echo of...
by penpen
16 Jul 2013 18:47
Forum: DOS Batch Forum
Topic: Help creating xcopy batch file??
Replies: 5
Views: 4282

Re: Help creating xcopy batch file??

If source is a directory, and
destination is a directory too, or not existing, and
your batch is in the right directory,
then this code should work well.

Maybe you rem out the @echo off line, and see what error message will be displayed.

penpen
by penpen
16 Jul 2013 18:27
Forum: DOS Batch Forum
Topic: A different method to trim spaces from a string
Replies: 16
Views: 19240

Re: A different method to trim spaces from a string

Is it any safer if we just pass the name of the variable whose value is to be trimmed rather than the value itself? Much better, i have tested all tricks, i remembered, on your safetrim.bat: @echo off set x=%1 for /f "tokens=1* delims==" %%a in ( 'set %1' do call :exec %%b goto :EOF :exec...