Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running Vista Home Premium. I tried to write a script to do some simple automation.... it does not work!

even the most simple script like:

@echo ON
dir .

does not get executed and only an empty CMD shell pops open when started from explorer. From the cmd windows there is no problem.

This is really weird and I have never seen this before (but wrote many CMD scripts before)

ftype cmdfile and batfile are unchanged from "%1" %*

virusscan done - no problems

Is there a policy setting that might have changed? Any ideas?

share|improve this question

5 Answers 5

Right click on script, click "Run As Administrator"

share|improve this answer
    
i am already logged in as Administrator. the cmd window that opens has Administrator rights –  jamesvista Nov 18 '09 at 20:38
    
Are you sure about that? blogsdna.com/2168/… –  Marcin Nov 18 '09 at 22:17
    
it says so in the title ;) –  jamesvista Nov 20 '09 at 10:35

Are you sure it's not executing too quickly?

Add a pause after the end and try again.

share|improve this answer
    
the output is different from my reference in the virtual machine. I try to find out here what could be broken in this VISTA installation. –  jamesvista Nov 18 '09 at 20:42

Lateral thinking, try PowerShell? Especially the ISE (Integrated Scripting Engine) GUI.

You can even start with built-in commands then work your way up to the PowerShell cmdlets. My view this is 'the way to go'.

share|improve this answer
1  
Q:"My car's not working!" A:"Buy a jet!" - but +1 because PS is something everyone should use anyway. –  Phoshi Nov 18 '09 at 18:57
1  
I know there are workarounds but I think here is something really wrong. E.g. I can run the script from within CMD window but not from explorer directly like I did so many times before. –  jamesvista Nov 18 '09 at 20:41

Originally, Microsoft intended to incorporate a new command shell in Vista but then decided to make the new shell a stand-alone application. The new application is called Powershell http://technet.microsoft.com/en-us/scriptcenter/dd742419

Thus, the old command interpreter cmd.exe has been continued although in a slightly newer version. (The Vista version is 6.0 whereas the XP version is 5.1.) Several commands are now in the standard list that were formerly available only in Support Tools or the Server 2003 Tools. There are also some new commands and they are indicated with an asterisk in the list below. Note that some commands may require administrator privileges.

http://technet.microsoft.com/en-us/library/bb490890.asp

share|improve this answer

Sounds like your environment variables are corrupt ..

Open up a command prompt and type

echo %path%

And see what comes up then .. If the system32 folder isn't in there; then you might want to put it in there :)

share|improve this answer
    
Both dir and echo are shell-builtins and don't need PATH. –  Joey Nov 16 '10 at 1:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.