COMSPEC

Started by JTaylor, June 22, 2018, 02:54:08 PM

Previous topic - Next topic

JTaylor

Having run out of ideas I thought I would ask here...The following gives no errors but I get no output when run in WinBatch.  If I take the resulting b_param value and paste it into a command prompt it works as it should and I get the desired results (Chrome history).  I have tried both the 32 and 64-bit command prompts.   Guessing it may be a UAC issue but no real idea.  Suggestions?

Code (winbatch) Select


sql_exe = DirScript():"sqlite3.exe"

   h_path = ShortcutDir("Local AppData", 0, @TRUE):"Google\Chrome\User Data\Default\"

   cmd_32 = DirWindows(0):'syswow64\CMD.EXE'
   cmd_64 = DirWindows(0):'Sysnative\CMD.EXE'

   b_param = `/c "`:sql_exe:`" "%h_path%History" "SELECT datetime(last_visit_time/1000000-11644473600,'unixepoch','localtime'), urls.* FROM urls;" > hist.txt `

   comspec=Environment("COMSPEC")
   RunWait(comspec,b_param)
 
   clipput(b_param)
   message(comspec,b_param)

 




stanl

I got the same results as you, but I ran the section in the script below I posted in 2001 that dealt with Chrome Browser [SQLite driver] and that worked. Gonna have to try putting the entire command into a .bat file


http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/OLE~COM~ADO~CDO~ADSI~LDAP/SQLite+Multi~Browser~History~Report.txt

JTaylor

A batch file works as well.   That route is probably viable but not the ODBC or .NET route though.   Still hoping for a straight run from WinBatch but you know how it goes sometimes  :)

Also, I tried compiling & signing but still doesn't work.

Thanks.

Jim

td

Have you tried switching the "/c" to "/K"?  There is some small possibility that the command window will contain some error information.  The cause of your problem may be as simple as not having the correct working directory set or it could be something completely different.  The fact that you don't get a WinBatch/WIL error suggests that the problem has something to do with cmd.exe being unhappy rather than WinBatch.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

I thought I remembered seeing a "K" used before but couldn't find any examples.  Guess I should have tried it anyway instead of thinking my thinking was wrong.  You are correct, as usual.  The error message is "The filename, directory name, or volume label syntax is incorrect."   I have full path names for everything but apparently one cannot put quotes around some paths.   If I take away the quotes from the sqlite exe and the output file name it works directly in WinBatch.    If my path has spaces then it fails even if I use quotes.   Probably a reason but at least I know a way to make it work.    Thanks.

Jim

td

If you type "cmd /?" from a command prompt and scroll down a bit, you will get to a long explanation of when quotes are preserved on the command line.  Good luck sorting it out.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Before I spend a lot of time trying to sort it out will it help explain why it works from the command line but not in WinBatch?   Seems like it would simply tell me what would or wouldn't work, which what I was doing did work from the command line.

Jim

td

It depends.  The hope was that the help description would lead to an insight but maybe not.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Okay.  I will see if it tells me anything and report back if any epiphanies occur.  Thanks again.

Jim

JTaylor

Okay.   Again, as usual, you are correct.    It appears that the command line is treated differently if one uses /C or /K in regards to quote processing.   Something good for everyone to know, assuming I am the only one who doesn't, which often seems to the be the case with things :).   Rather than creating confusion I will simply suggest that anyone encountering problems along these lines read the cmd.exe help.

Jim

stanl

Out of curiosity.... would have setting it up as a shortcut revealed the issues earlier

JTaylor

Hmmmmmmmm....not sure if I understand.   Only the /K helped because it keeps the command window open so I could see the errors.   Since it was a command prompt error WinBatch didn't report anything and everything closed cleanly, as expected, when using /c.

Jim