Batch script works only from C:\users\ps\Desktop\ but fails otherwise

pstein

New member
Member
VIP
Local time
5:11 AM
Messages
244
When I (as member of the Administrators group) enter at the Command Prompt "nbtstat -n" it works.

When I put the same command into a batch script "C:\Users\ps\Desktop\test.bat" (=a file on my Desktop) and run it
it works.

When I copy/move this batch script file to any other directory on partition C: or D: and execute it by double click it fails with the notification:

'nbtstat' is not recognized as an internal or external command,
operable program or batch file.

Why?

I guess this has something to do with permissions.
 

My Computer My Computer

At a glance

win7pro 64bit
Computer type
PC/Desktop
OS
win7pro 64bit
Open a cmd prompt type
set
is the folder for nbstat in the path?
 

My Computer My Computer

At a glance

win 8 32 bit
Computer type
PC/Desktop
OS
win 8 32 bit
Right click the My Computer icon. Chose Properties. Go to Advanced system settings. Advanced tab and Environment Variables. Under system variables you have to scroll down a bit and find PATH. Make sure this is in it amongst the rest in the PATH:

C:\windows\system32;

The semicolon is a separator.
 

My Computer My Computer

At a glance

Windows 7 Ultimate x64
Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
Back
Top