Search found 26 matches

by rojo
28 Nov 2018 12:59
Forum: DOS Batch Forum
Topic: CSV.BAT - CSV file manipulation with SQL syntax
Replies: 33
Views: 9109

Re: CSV.BAT - CSV file manipulation with SQL syntax

Squashman wrote:
27 Nov 2018 14:10
npocmaka_ wrote:
27 Nov 2018 13:42
It would be useful if you can use/create a custom schema file in order to handle other data types than string.
I thought Rojo explained how to do that in this thread because I had asked him about it.
I think he did. viewtopic.php?p=43562#p43562
by rojo
30 Jul 2017 00:22
Forum: DOS Batch Forum
Topic: Batchscript to extract texts from multiple lines
Replies: 18
Views: 2334

Re: Batchscript to extract texts from multiple lines

I had another idea of using System.IO.StreamReader() to read the text file, to avoid loading the entire thing into active memory as the previous solutions all do. With plasma33's example text file, this method is slower than dbenham's JScript hybrid (around 33 seconds for my script, versus around 8 ...
by rojo
23 Sep 2016 11:59
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 24
Views: 14944

Re: Powershell2/bat hybrid?

Running test.cmd -name aaa -path bbb I get Name: -name Path: aaa You could simulate "param()" by looping through $argv . <# : batch portion @echo off & setlocal (for %%I in ("%~f0";%*) do @echo(%%~I) | ^ powershell -noprofile "$argv = $input | ?{$_}; iex (${%~f0} | out-...
by rojo
29 Jan 2016 22:53
Forum: DOS Batch Forum
Topic: Powershell2/bat hybrid?
Replies: 24
Views: 14944

Re: Powershell2/bat hybrid?

I find it much easier to let powershell read environment variables in the "env" scope than to try to pass-through script arguments. <# : batch portion @echo off & setlocal set "arg=%~1" powershell -noprofile "iex (${%~f0} | out-string)" goto :EOF : end batch / begin...
by rojo
23 Oct 2015 16:38
Forum: DOS Batch Forum
Topic: CSV.BAT - CSV file manipulation with SQL syntax
Replies: 33
Views: 9109

Re: CSV.BAT - CSV file manipulation with SQL syntax

My time has come. This is the moment I've been waiting for. My script has become useful to someone. All my toil and strife has not been in vain.
by rojo
23 Oct 2015 14:05
Forum: DOS Batch Forum
Topic: CSV.BAT - CSV file manipulation with SQL syntax
Replies: 33
Views: 9109

Re: CSV.BAT - CSV file manipulation with SQL syntax

So if my files have no header and are pipe delimited what do I change the Format be? [test.tsv] ColNameHeader=False CharacterSet=1252 Format=?????? Col1=year Integer Col2=make Char Width 255 Col3=model Char Width 255 Col4=color Char Width 255 Col5=worth Text Try this: Format=Delimited(|) I would've...
by rojo
23 Oct 2015 13:37
Forum: DOS Batch Forum
Topic: CSV.BAT - CSV file manipulation with SQL syntax
Replies: 33
Views: 9109

Re: CSV.BAT - CSV file manipulation with SQL syntax

Still want to get around to trying this out but it is still way over my head on how it all works. Can you post an example of a schema.ini and how I would use that schema.ini to run the bat file? Thanks OK. Basic example. Say you've got a directory containing a file called "test.tsv" with ...
by rojo
05 Feb 2015 15:21
Forum: DOS Batch Forum
Topic: Lambdas or something alike...
Replies: 3
Views: 1154

Re: Lambdas or something alike...

A lambda is a throwaway function. I generally associate lambdas with JavaScript's replace functions. Something like: // This is JavaScript. var count=0 "The quick brown fox".replace(/\w/g, function(m) { count++ }); ... would count the letters in the string. There are 16. You're welcome.
by rojo
05 Feb 2015 14:53
Forum: DOS Batch Forum
Topic: Pin programs via script or un pin
Replies: 19
Views: 11982

Re: Pin programs via script or un pin

Programmatically pin to taskbar seems relevant. You can use the Pin to Taskbar or Unpin from Taskbar verb through Shell.Application using VBScript or JScript. I'd probably do it as a JScript hybrid.
by rojo
05 Feb 2015 08:13
Forum: DOS Batch Forum
Topic: Need way to set Wallpaper variable??
Replies: 3
Views: 1386

Re: Need way to set Wallpaper variable??

In Windows XP and earlier, you used to be able to refresh the desktop wallpaper with a rundll32 invocation of a user32.dll function. Not so since Vista. You'll probably have to invoke a PowerShell script. See this page for an example.
by rojo
29 Jan 2015 10:34
Forum: DOS Batch Forum
Topic: Validate Whole Number or Zero with Function
Replies: 8
Views: 1797

Re: Validate Whole Number or Zero with Function

Compo wrote:What's wrong with this?

Code: Select all

Echo(%variable%|FindStr "[^0-9]">Nul&&(Echo(Non integer)||(Echo(Integer)


Internal functions are generally faster than executables. Your solution is simpler, but less efficient.
by rojo
29 Jan 2015 10:05
Forum: DOS Batch Forum
Topic: Validate Whole Number or Zero with Function
Replies: 8
Views: 1797

Re: Validate Whole Number or Zero with Function

I am trying to use a function to validate numeric input. This method, not in a function, was recently posted as a solution in this forum. Can you tell me why the function below does not communicate the result, which would be FALSE in this example, after the function exits? After the call line, the ...
by rojo
29 Jan 2015 08:11
Forum: DOS Batch Forum
Topic: How to differentiate directory vs file in loop
Replies: 21
Views: 4066

Re: How to differentiate directory vs file in loop

The simplest test is to append \ and test if it exists: if exist "%%F\" (echo %%F is a folder) else (echo %%F is a file) It's fine for a local drive but this will fail on a network drive IIRC. After testing, it appears that it doesn't fail on a network drive; but it succeeds where it shou...
by rojo
18 Jan 2015 12:33
Forum: DOS Batch Forum
Topic: CSV.BAT - CSV file manipulation with SQL syntax
Replies: 33
Views: 9109

Re: CSV.BAT - CSV file manipulation with SQL syntax

Great tool :-) Do you have any idea why pointing directly to HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Jet\\4.0\\Engines\\Text\\ does not work but it requires 32bit version of cscript? Thanks! I haven't had any practical use for it yet, but maybe it'll save somebody's life some day. The...
by rojo
18 Jan 2015 09:18
Forum: DOS Batch Forum
Topic: CSV.BAT - CSV file manipulation with SQL syntax
Replies: 33
Views: 9109

Re: CSV.BAT - CSV file manipulation with SQL syntax

Version 1.1.2 Added: ⋅  /S switch to auto generate Schema.ini for all text files in the specified directory If your CSV files are being interpreted incorrectly by the script, generating a Schema.ini and tweaking the column data types might help. See the Schema.ini documentation for suppor...