Startup Group shortcut to BAT file fails for some users

R

Rich Pasco

My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich
 
P

Pegasus \(MVP\)

Rich Pasco said:
My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.
 
R

Rich Pasco

Pegasus said:
Rich Pasco said:
My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.

None of that in my batch file. The entire BAT file is two lines:

@echo off
echo %username% > c:\logfiles\login.log

It works fine if I manually click on its icon in the Startup group.

- Rich
 
P

Pegasus \(MVP\)

Rich Pasco said:
Pegasus said:
Rich Pasco said:
My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.

None of that in my batch file. The entire BAT file is two lines:

@echo off
echo %username% > c:\logfiles\login.log

It works fine if I manually click on its icon in the Startup group.

- Rich

It is not possible for the "echo" command to generate the error
message "no application is associated with the file". There must
be something else lurking in the corner. I suspect that the error
message is not generated by this batch file but by another batch
file that you're not aware of. You can easily prove it: Make the
second line a "pause" line. I bet you will find that the batch file
never pauses!

You should also turn "echo on", not off, to make things visible.
 
R

Rich Pasco

Pegasus said:
Rich Pasco said:
Pegasus said:
My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.

None of that in my batch file. The entire BAT file is two lines:

@echo off
echo %username% > c:\logfiles\login.log

It works fine if I manually click on its icon in the Startup group.

- Rich

It is not possible for the "echo" command to generate the error
message "no application is associated with the file". There must
be something else lurking in the corner. I suspect that the error
message is not generated by this batch file but by another batch
file that you're not aware of. You can easily prove it: Make the
second line a "pause" line. I bet you will find that the batch file
never pauses!

You should also turn "echo on", not off, to make things visible.

The problem I have been asking for help with is that Windows can find no
association with the BAT file itself--which I suppose should be cmd.exe.
You've been trying to debug the content of my BAT file, when my problem
is getting Windows to run it at all. In other words, the problem is not
within the BAT file, it's getting it to execute in the first place.

So I replaced the BAT file with this one:

pause
echo hello

and as you predicted it didn't pause.

So back to square one: What is preventing Windows from executing this
(or any) BAT file? To recap:

- If I later open the Startup group and click on the shortcut icon,
the BAT file executes correctly. The problem happens only when I
first log in.

- If I log in as a different user, with Administrator privilege,
then the BAT file executes automatically (via its Startup group
shortcut).

- Rich
 
P

Pegasus \(MVP\)

Rich Pasco said:
Pegasus said:
Rich Pasco said:
Pegasus (MVP) wrote:

My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.

None of that in my batch file. The entire BAT file is two lines:

@echo off
echo %username% > c:\logfiles\login.log

It works fine if I manually click on its icon in the Startup group.

- Rich

It is not possible for the "echo" command to generate the error
message "no application is associated with the file". There must
be something else lurking in the corner. I suspect that the error
message is not generated by this batch file but by another batch
file that you're not aware of. You can easily prove it: Make the
second line a "pause" line. I bet you will find that the batch file
never pauses!

You should also turn "echo on", not off, to make things visible.

The problem I have been asking for help with is that Windows can find no
association with the BAT file itself--which I suppose should be cmd.exe.
You've been trying to debug the content of my BAT file, when my problem
is getting Windows to run it at all. In other words, the problem is not
within the BAT file, it's getting it to execute in the first place.

So I replaced the BAT file with this one:

pause
echo hello

and as you predicted it didn't pause.

So back to square one: What is preventing Windows from executing this
(or any) BAT file? To recap:

- If I later open the Startup group and click on the shortcut icon,
the BAT file executes correctly. The problem happens only when I
first log in.

- If I log in as a different user, with Administrator privilege,
then the BAT file executes automatically (via its Startup group
shortcut).

- Rich

You now believe that Windows cannot execute netlogon.bat because
it fails to resolve the .bat extension at startup time. You can easily
prove it, by doing this:
- Place a copy of notepad.exe into the netlogon folder and into the
"All Users" Startup folder.
- Replace "netlogon.bat" with "notepad.exe" in the logon script field
of the user profile.
- Log on. What happens?

I would also like to know the contents of the user's personal
startup folder. What exactly is there?
 
R

Rich Pasco

Pegasus said:
Rich Pasco said:
Pegasus said:
Pegasus (MVP) wrote:

My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is what the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.

None of that in my batch file. The entire BAT file is two lines:

@echo off
echo %username% > c:\logfiles\login.log

It works fine if I manually click on its icon in the Startup group.

- Rich



It is not possible for the "echo" command to generate the error
message "no application is associated with the file". There must
be something else lurking in the corner. I suspect that the error
message is not generated by this batch file but by another batch
file that you're not aware of. You can easily prove it: Make the
second line a "pause" line. I bet you will find that the batch file
never pauses!

You should also turn "echo on", not off, to make things visible.

The problem I have been asking for help with is that Windows can find no
association with the BAT file itself--which I suppose should be cmd.exe.
You've been trying to debug the content of my BAT file, when my problem
is getting Windows to run it at all. In other words, the problem is not
within the BAT file, it's getting it to execute in the first place.

So I replaced the BAT file with this one:

pause
echo hello

and as you predicted it didn't pause.

So back to square one: What is preventing Windows from executing this
(or any) BAT file? To recap:

- If I later open the Startup group and click on the shortcut icon,
the BAT file executes correctly. The problem happens only when I
first log in.

- If I log in as a different user, with Administrator privilege,
then the BAT file executes automatically (via its Startup group
shortcut).

- Rich

You now believe that Windows cannot execute netlogon.bat because
it fails to resolve the .bat extension at startup time. You can easily
prove it, by doing this:
- Place a copy of notepad.exe into the netlogon folder and into the
"All Users" Startup folder.
- Replace "netlogon.bat" with "notepad.exe" in the logon script field
of the user profile.
- Log on. What happens?

I would also like to know the contents of the user's personal
startup folder. What exactly is there?

No, I never said anything about netlogon.bat -- in fact, I've never
heard of that file. I named my batch file "login.bat"; any resemblance
to any other filename is purely coincidental.

The entire content of this startup group is as follows:

Inherited from "all users":
eFax.com tray menu
Live Menu (also part of eFax system)
Acrobat Assistant Speed Launch
Adobe Reader Speed Launch
login.bat (subject of this thread)
Unique to this user:
(none)

The other applications (eFax and Acrobat) launch fine.

Please note there is no shortcut to netlogon.bat whatsoever.

I added, to the "all users" startup group, a shortcut to
%windir%\system32\notepad.exe
and now, when my troubled user logs in, a new Notepad session
starts as expected.

But Windows still complains,

c:\profiles\login.bat
This file does not have a program associated with it for performing
this action. Create an association in the Folder Options control
panel.

- Rich
 
P

Pegasus \(MVP\)

Rich Pasco said:
Pegasus said:
Rich Pasco said:
Pegasus (MVP) wrote:

Pegasus (MVP) wrote:

My Startup Group for "All Users" contains a shortcut to a BAT file.
When a member of group "Administrators" logs in, it executes just fine.
When a member of group "Users" logs in, he gets the response "no
application is associated with the file..." If this same user later
manually clicks on the same shortcut, the BAT file executes correctly.
So why won't it execute when he is first logging in? That is
what
the
Startup Group is for.

I'm running Microsoft Windows 2000 [Version 5.00.2195].

- Rich

Let's have a look at your startup batch file! You are most likely
trying to invoke some application by relying on an association
that is not present at that stage. For example, instead of coding
like so:

notepad c:\SomeFile.txt, you code like so:
c:\SomeFile.txt

Unless Windows knows that all .txt files must be opened with
notepad.exe, the batch file will fail.

None of that in my batch file. The entire BAT file is two lines:

@echo off
echo %username% > c:\logfiles\login.log

It works fine if I manually click on its icon in the Startup group.

- Rich



It is not possible for the "echo" command to generate the error
message "no application is associated with the file". There must
be something else lurking in the corner. I suspect that the error
message is not generated by this batch file but by another batch
file that you're not aware of. You can easily prove it: Make the
second line a "pause" line. I bet you will find that the batch file
never pauses!

You should also turn "echo on", not off, to make things visible.

The problem I have been asking for help with is that Windows can find no
association with the BAT file itself--which I suppose should be cmd.exe.
You've been trying to debug the content of my BAT file, when my problem
is getting Windows to run it at all. In other words, the problem is not
within the BAT file, it's getting it to execute in the first place.

So I replaced the BAT file with this one:

pause
echo hello

and as you predicted it didn't pause.

So back to square one: What is preventing Windows from executing this
(or any) BAT file? To recap:

- If I later open the Startup group and click on the shortcut icon,
the BAT file executes correctly. The problem happens only when I
first log in.

- If I log in as a different user, with Administrator privilege,
then the BAT file executes automatically (via its Startup group
shortcut).

- Rich

You now believe that Windows cannot execute netlogon.bat because
it fails to resolve the .bat extension at startup time. You can easily
prove it, by doing this:
- Place a copy of notepad.exe into the netlogon folder and into the
"All Users" Startup folder.
- Replace "netlogon.bat" with "notepad.exe" in the logon script field
of the user profile.
- Log on. What happens?

I would also like to know the contents of the user's personal
startup folder. What exactly is there?

No, I never said anything about netlogon.bat -- in fact, I've never
heard of that file. I named my batch file "login.bat"; any resemblance
to any other filename is purely coincidental.

The entire content of this startup group is as follows:

Inherited from "all users":
eFax.com tray menu
Live Menu (also part of eFax system)
Acrobat Assistant Speed Launch
Adobe Reader Speed Launch
login.bat (subject of this thread)
Unique to this user:
(none)

The other applications (eFax and Acrobat) launch fine.

Please note there is no shortcut to netlogon.bat whatsoever.

I added, to the "all users" startup group, a shortcut to
%windir%\system32\notepad.exe
and now, when my troubled user logs in, a new Notepad session
starts as expected.

But Windows still complains,

c:\profiles\login.bat
This file does not have a program associated with it for performing
this action. Create an association in the Folder Options control
panel.

- Rich

I did not know if you were operating in a domain or
workgroup environment, or the precise name of your
problem file (even though you may have mentioned it
some time before).

Now that I am more familiar with your environment,
I am in a position to speak more precisely. Here is
what I recommend, in this order:

1. Remove login.bat from the startup folder. Does the problem persist?
2. Restore login.bat to the startup folder. Place exactly two lines inside:
echo Executing %0 (this is the numeral 0, not the letter o)
pause
What do you see?
3. Start a Command Prompt.
4. Type this command: set pathext
What do you see?
5. Type this command: set comspec
What do you see?
 
R

Rich Pasco

Pegasus said:
1. Remove login.bat from the startup folder. Does the problem persist?

Of course Windows no longer complains that it can't find an association
for it, but then again, it doesn't execute either.
2. Restore login.bat to the startup folder. Place exactly two lines inside:
echo Executing %0 (this is the numeral 0, not the letter o)
pause
What do you see?

As before, the login.bat does not execute at all. Instead I see

c:\profiles\login.bat
This file does not have a program associated with it for performing
this action. Create an association in the Folder Options control
panel.
3. Start a Command Prompt.
4. Type this command: set pathext
What do you see?
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

5. Type this command: set comspec
What do you see?

ComSpec=C:\WINNT\system32\cmd.exe

Note: If I try invoking login.bat from the command prompt, it
executes correctly. It reports:

Executing login1
Press any key to continue . . .

As I already noted, my login.bat works correctly if I manually
double-click on its shortcut in the Startup Group; it just doesn't
work automatically at log in.

- Rich
 
P

Pegasus \(MVP\)

I'm rapidly running out of ideas. There are two straws left - see below.

The behaviour you describe is quite out of character with Win2000.
I suspect that your machine suffered some corruption in the registry,
through some malfunction, malware or virus activity.

Rich Pasco said:
Of course Windows no longer complains that it can't find an association
for it, but then again, it doesn't execute either.

This is what I expected, but I had to make sure.

As before, the login.bat does not execute at all. Instead I see

c:\profiles\login.bat
This file does not have a program associated with it for performing
this action. Create an association in the Folder Options control
panel.

Here are the straws I'm clutching at:
- Copy c:\profiles\login.bat to c:\profiles\trouble.cmd, then try again.
- Move login.bat somewhere else, then use an executable to invoke
login.bat. I can knock up a little executable if you decide to go
down this path.
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

Looks perfectly OK.

ComSpec=C:\WINNT\system32\cmd.exe

Again it's the way it should be.
 
R

Rich Pasco

Pegasus said:
I'm rapidly running out of ideas. There are two straws left - see below.

The behaviour you describe is quite out of character with Win2000.
I suspect that your machine suffered some corruption in the registry,
through some malfunction, malware or virus activity.

I keep Norton Antivirus installed and up-to-date, scan all incoming
files and e-mail and run a full system scan weekly, and have never
detected any infection.
Here are the straws I'm clutching at:
- Copy c:\profiles\login.bat to c:\profiles\trouble.cmd, then try again.

If it is named trouble.cmd or login.cmd it works perfectly.
If it is named trouble.bat or login.bat it fails with the
no-association message.
- Move login.bat somewhere else, then use an executable to invoke
login.bat. I can knock up a little executable if you decide to go
down this path.

I tried changing my shortcut to
cmd /c c:\profiles\login.bat
and that worked OK as well.

It only fails when the shortcut points directly to a BAT file.
It works OK if the shortcut points do an otherwise identical CMD
file, or if a cmd.exe shell is used to launch the BAT file.

- Rich
 
R

Rich Pasco

Pegasus said:
I suspect that your machine suffered some corruption in the registry...

I took a look in the registry, using REGEDIT. Here is what I found:

Under HKEY_CLASSES_ROOT
.bat (Default) was "TextPad.bat"
.cmd (Default) was "cmdfile"
batfile (Default) was "MS-DOS Batch File"
cmdfile (Default) was "Windows NT Command Script"
TextPad.bat (Default) was "MS-DOS Batch File"

I modified the definition of .bat, replacing "TextPad.bat" with
"batfile". Now login.bat works as desired under both users!

Now, how did this "corruption" occur and what does it mean?
TextPad is a popular text editor which I use.
See http://www.textpad.com/

Before I "fixed" the problem as above, I could right-click
on a BAT file and choose "Edit" and it would open in Textpad.
Now it opens in Notepad.

I'm only beginning to understand what happened here...

- Rich
 
P

Pegasus \(MVP\)

Rich Pasco said:
Since the problem seems to be related to TextPad, I
posted the question there:
http://www.textpad.info/forum/viewtopic.php?p=20057

Thanks,

- Rich

It seems my last straw, using the .cmd extension, gave you
the key to your problem. Note that .cmd files are processed
in exactly the same way as .bat files under WinNT and up.
Note also that malware and spyware has the capacity to
modify registry settings, and that many such programs are
not picked up by virus scanners. However, in your case
I suspect that TextPad is the culprit. Did you make the
connection between you installing TextPad and your logon
batch file failing?
 
R

Rich Pasco

Pegasus said:
It seems my last straw, using the .cmd extension, gave you
the key to your problem. Note that .cmd files are processed
in exactly the same way as .bat files under WinNT and up.
Note also that malware and spyware has the capacity to
modify registry settings, and that many such programs are
not picked up by virus scanners. However, in your case
I suspect that TextPad is the culprit. Did you make the
connection between you installing TextPad and your logon
batch file failing?

I had installed TextPad under my account with Administrator privileges
long before creating the second account with ordinary User privileges.
From the beginning my BAT file never worked under that User account,
and I don't know how it would have worked if I hadn't installed TextPad
first.

There are still some unanswered questions in my mind:
(1) Why did the BAT file work for Administrator and not for the User?
(2) Why did it fail at Startup but run if I manually double-click on
its shortcut in the Startup grup?
(3) Why did it fail when defined as "TextPad.bat" but run when defined
as "batfile"?

Hopefully my post to the TextPas forum will yield some answers:
http://www.textpad.info/forum/viewtopic.php?p=20057

Thank you for all your help!

- Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top