Search found 1966 matches
- 20 Jul 2013 12:08
- Forum: DOS Batch Forum
- Topic: need help of hybrid jscript from vb DateLastModified
- Replies: 9
- Views: 10607
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...
- 20 Jul 2013 11:17
- Forum: DOS Batch Forum
- Topic: batch file to search and copy particular file
- Replies: 13
- Views: 12661
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&...
- 19 Jul 2013 08:54
- Forum: DOS Batch Forum
- Topic: batch file to search and copy particular file
- Replies: 13
- Views: 12661
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...
- 17 Jul 2013 14:17
- Forum: DOS Batch Forum
- Topic: Merge .txt files in folders, adding commas and quotationmark
- Replies: 8
- Views: 7685
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...
- 17 Jul 2013 08:24
- Forum: DOS Batch Forum
- Topic: Why no time in TIME.TXT :- echo %time% > TIME.TXT > NUL
- Replies: 5
- Views: 5647
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...
- 17 Jul 2013 06:12
- Forum: DOS Batch Forum
- Topic: Why no time in TIME.TXT :- echo %time% > TIME.TXT > NUL
- Replies: 5
- Views: 5647
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...
- 17 Jul 2013 04:54
- Forum: DOS Batch Forum
- Topic: Run Batch File at Specific Time
- Replies: 7
- Views: 9379
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...
- 17 Jul 2013 01:19
- Forum: DOS Batch Forum
- Topic: Run Batch File at Specific Time
- Replies: 7
- Views: 9379
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.
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.
- 17 Jul 2013 00:55
- Forum: DOS Batch Forum
- Topic: A different method to trim spaces from a string
- Replies: 16
- Views: 18895
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...
- 16 Jul 2013 18:47
- Forum: DOS Batch Forum
- Topic: Help creating xcopy batch file??
- Replies: 5
- Views: 4195
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
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
- 16 Jul 2013 18:27
- Forum: DOS Batch Forum
- Topic: A different method to trim spaces from a string
- Replies: 16
- Views: 18895
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...
- 16 Jul 2013 17:00
- Forum: DOS Batch Forum
- Topic: CSV to QIF Using Batch?
- Replies: 9
- Views: 9230
Re: CSV to QIF Using Batch?
Do you mean with CSV and QIF the Comma-Separated Values format and the Quicken Interchange Format? If yes, i assume this conversion is possible IF you have a specification for the comma-separated values format. The problem would be to define a clean specification to hold the same data as the QIF, as...
- 16 Jul 2013 16:36
- Forum: DOS Batch Forum
- Topic: Merge .txt files in folders, adding commas and quotationmark
- Replies: 8
- Views: 7685
Re: Merge .txt files in folders, adding commas and quotation
Just help those closest to you as much as you can, as much as you want!
Regards,
penpen.
Regards,
penpen.
- 16 Jul 2013 16:30
- Forum: DOS Batch Forum
- Topic: Run Batch File at Specific Time
- Replies: 7
- Views: 9379
Re: Run Batch File at Specific Time
If you count all executables in %SystemRoot%\system32 to pure command line dos i would prefer cscript.exe: @if (true == false) then /* @echo off %SystemRoot%\system32\cscript.exe //E:JScript "%~f0" "10:00" :: code to execute goto :eof */ @end if (WScript.Arguments.Unnamed.Length ...
- 16 Jul 2013 15:02
- Forum: DOS Batch Forum
- Topic: A different method to trim spaces from a string
- Replies: 16
- Views: 18895
Re: A different method to trim spaces from a string
@Samir It seems to right trim only: Z:\>for %f in (" test test test ") do echo "%~nf" " test test test" @probyn This woorks very good, but is unsafe: trim asdad asd ^& echo Leak Maybe i am a little bit too mistrustful, but this is my maxime on external input. penpen...