[dba-Tech] The Command prompt line length

Jim Lawrence accessd at shaw.ca
Sun Jul 19 22:16:31 CDT 2009


Thanks Bobby:

If you want to see what the actual code does exchange the function 'set' for
'echo'

Change:
for /F "tokens=2-4 delims=/ " %i in ('date /t') do set dt=%k%i%j

To:
for /F "tokens=2-4 delims=/ " %i in ('date /t') do echo dt=%k%i%j
or...
for /F "tokens=2-4 delims=/ " %i in ('date /t') do echo %k%i%j

Copy one of the above lines to the command lind and press enter.

Next, to test the line of code in a batch file open up a notepad session,
paste the line in and save it to some file like 'test.bat'; then try to run
the batch file and see if it works. If it does not then you can see the same
error as I am.

Jim 

 

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Bobby Heid
Sent: Sunday, July 19, 2009 5:39 PM
To: 'Discussion of Hardware and Software issues'
Subject: Re: [dba-Tech] The Command prompt line length

Jim.

Is it possible that when the line is expanded internally that it is too
long?  I don't know where %i is pointing to, but my guess is that the folder
that %i is pointing to is pretty long.

Bobby

-----Original Message-----
From: dba-tech-bounces at databaseadvisors.com
[mailto:dba-tech-bounces at databaseadvisors.com] On Behalf Of Jim Lawrence
Sent: Sunday, July 19, 2009 6:56 PM
To: 'Discussion of Hardware and Software issues'
Subject: [dba-Tech] The Command prompt line length

Hi All:

Has anyone heard of there being a limit of a line length within a batch
file?

I have a batch file that creates a directory and writes some backup data to
it. This batch file works fine on other computers but on a specific computer
the batch files fails on a longer line (64 characters). If the same line is
run in direct mode no problem.

The syntax is correct because if the line is cut and pasted to a command
prompt the line functions correctly. The rest of the batch file runs fine
without that one line... so it is related exclusively to the one line of
code.

Putting that one line of code into a batch file and then running it results
in the same error. It appears that it is not buffering the whole line before
attempting to run it.

If anyone has run across this type of issues before and hopefully found a
solution please pass it on.

TIA
Jim

PS the cmd line of code is:
for /F "tokens=2-4 delims=/ " %i in ('date /t') do set dt=%k%i%j  

_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com


_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list