|
Post by mknarr on Jan 22, 2021 11:05:54 GMT -5
I have a program that has been in use for years and all of a sudden the CommandLine$ seems to be failing.
It is a backup program I wrote and have been using for years called BackupforMyPC. It is run as an exe with a tkn. There is a second program called BackupScheduler that is also run as a exe with a tkn. The second program looks like this:
nomainwin 'LB4.50 run "BackupforMyPC.exe scheduled" end
It's purpose is to be run at night by the Win 10 task scheduler and does so. The main program part that deals with the Commandline$ looks like this
CommandLine$=word$(CommandLine$,2) 'CommandLine$="scheduled" 'Unremark this line to run the schedule while debugging.
if(CommandLine$)="scheduled" then 'If this is a scheduled backup this section will run. files DefaultDir$, "schedule.ini", info$() if val(info$(0,0))=0 then end 'If a schedule doesn't exist then end gosub [GetSchedule] 'else get the schedule. BackupRestore$="Backup" 'BackupRestore$ tells Copyfile how to build the file names. gosub [MakeBackup] 'Skip everything and go directly to the backup routine. end end if
The whole purpose of this section is to run the program without the main window and any prompts. Note that there is a line rem'd out that forces the CommmandLine$ to be "scheduled" for testing purpose only and it works as it is supposed to when run as a bas. Even if I unremark the line and run as a tkn it works as it is supposed
The problem is when I run BackupScheduler as either an exe or a tkn, it seems the main program no longer recognizes CommandLine$ and the main window comes up and I have to run the backup myself.
I have taken out the nomainwin and tried to print the CommandLine$ both before and after the word "BackupScheduler.exe" is removed while the program runs and nothing prints like CommandLine$ is empty.
This has only happened recently and I'm guessing it has to do with a Win 10 update since the program has run since 2014 with no updates to it. Any thoughts.
|
|
|
Post by Rod on Jan 22, 2021 14:27:53 GMT -5
By any chance have you changed the way you log on to the PC?
|
|
|
Post by Brandon Parker on Jan 22, 2021 15:14:57 GMT -5
Have you tried starting the program as an administrator?
{:0)
Brandon Parker
|
|
|
Post by mknarr on Jan 22, 2021 16:35:50 GMT -5
Rod, Yes. I had to change from using a pin to a password Brandon, yes and the same issue. As I said, dorm what I can gather, it does not recognizance the the CommandLine$.
If I don't use the CommandLine$ except to make it "Scheduled" the programs runs as it should. Again that leads me to believe that windows does not pass the program from the starting program as it is supposed to. BTW, the program was written in 4.5.0 and am now using 4.5.1.
|
|
|
Post by Chris Iverson on Jan 22, 2021 20:36:40 GMT -5
Wait, it started in 4.5?
When was the last time you updated the program?
|
|
|
Post by Brandon Parker on Jan 22, 2021 22:11:11 GMT -5
Are you compiling it with LB 4.5.1 and running it with the older LB 4.5.0 Runtime Engine possibly?
{:0)
Brandon Parker
|
|
|
Post by mknarr on Jan 23, 2021 10:55:57 GMT -5
That was it Brandon. Funny though. It's been running with the 4.5 runtime engine for years until about a month or so ago. It must have something to do with a Win 10 update and the old 4.5 version. BTW, I updated to 4.5.1 whenever it came out years ago.
I have other programs which were originally written in 4.5 and are most likely still using the 4.5 run engine with no apparent problems but only one other uses the CommndLine$. But the program that that creates the CommandLine$ still uses the 4.5 run engine since it is dated 2014 but the program that receives the CommandLine$ is dated 6/14/2017 so I suppose it is 4.5.1. It runs fine and I'm glad it does because I have about a 100 copies out there with customers and no complainants.
|
|
|
Post by Brandon Parker on Jan 23, 2021 17:47:56 GMT -5
Yeah, I think the problem arises when you compile code with the new compiler in LB 4.5.1 and then run it with the LB 4.5.0 Runtime Engine. If the code that is out there is 4.5.0 and running under the 4.5.0 Runtime then that should continue with no issue.
It probably would not hurt to roll out an update with the new 4.5.1 Runtime Engine and compiled code just so that all of your customers are using the same thing in case there are ever bug reports. Or, keep track of who has what out in the wild...
{:0)
Brandon Parker
|
|