Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a batch file (.bat) that creates a set of folders and it used to work. Now, it no longer executes directly from the windows environment when I double-click on it. What does happen, is the command window opens and displays the command prompt. If I type the batch file in this window it will execute properly.
I'm not sure what changed but something obviously did. Any help you can provide will be greatly appreciated. Below is the code.

Thanks

G:
CD "G:\Coursework\CIS 15 - Visual BASIC.NET\Grades\Lab 1"
MKDIR  "Folder1"
MKDIR  "Folder2"

pause
Posted
Updated 16-Feb-11 10:17am
v3
Comments
HimanshuJoshi 16-Feb-11 15:51pm    
Adding the batch file code would make much more sense you know.

Check for the dreaded UAC. To get you going try to run the batch file as administrator. If that works then you know what to do, don't you?
 
Share this answer
 
I suspect you don't describe your observations correctly. There should be no difference between CMD and Shell start of the batch file, as soon as you don't change the user. By the way, "command window opens and displays the command prompt" is expected behavior if you click on the batch on Shell, but it also should show you batch file lines (even if nothing works! this is kind of rudimentary debug feature. To disable this you should start with "@echo off". Maybe both ways worked but you failed to recognize that. You directory name could have changed or something. Another possibility is that what you were clicking was not a batch of file but a LNK file with the same name referencing batch file.

Now, "command window opens and displays the command prompt. If I type the batch file in this window it will execute properly." is not possible. If you click on file like that the console should close after you press any key.

So, all these details makes me thinking I cannot trust your description. You should do it much more accurately, reporting not what you think should happen, but precisely what you see and copy exact results, not describe in your own words.

If these checks does not help you, you need to copy the console contents verbosely in both cases and post it.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900