what is the default program to interpret windows batch file [closed] - windows

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I am working on windows 7 and I found that "notepad" was set as the default program for opening my .bat files. So when I try to execute the batch file by double clicking, it is opened by notepad.
I have tried setting cmd.exe as the default program, which didn't work.
What is the default program I should set for executing .bat files?

Click on "Start"->"Run" and type in "REGEDT32" and press Enter to start the Registry Editor.
Find the following key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.BAT\UserChoice
and delete the key named "UserChoice".

Check the output of the following commands:
C:\>
C:\>assoc .bat
.bat=batfile
C:\>ftype batfile
batfile="%1" %*
C:\>
If your output is different, you have to correct the settings
(see assoc /? and ftype /? for help)

Right click a bat file and select open with - and navigate to system32\cmd.exe
If it fails to apply the setting then security software may be blocking the registry changes.

Related

How to use program name with out specific path in .cmd file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
When I usually type following command in command prompt,
pageant "C:\Users\test\.ssh\id_rsa.ppk"
It have worked well.
But on the other hands,when I make test.cmd file like
pageant "C:\Users\test\.ssh\id_rsa.ppk"
And then double click, it didn't work
buttest.cmd in following script
"C:\Program Files\PuTTY\pageant.exe" "C:\Users\test\.ssh\id_rsa.ppk"
work well.
What is the different between them ?
I guess The path was recognized by cmd.
If someone has opinion, please let me know
If the command doesn't contain an absolute path and isn't an internal command then cmd.exe will find the executable in the current folder and then look in the folders in the %PATH% environment variable. It looks like the current folder in your cmd is C:\Program Files\PuTTY so pageant can be found and execute normally. If you cd to a different folder then it won't work unless the folder exists in %PATH%

How to add a "Run lua script" option in the context menu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I'm trying to add an option to run a lua script by right-clicking on the file.
I've already managed to add a "run as lua" option in the context menu and make it run a .bat file.
The program needs to execute
lua (file path)
But I don't know how to get this information into the command line.
I found how to do it!
Forget about running a batch file to run the program, just set cmd /k lua %1 as the value of the context menu entry.
If you want to add a "run as lua" option to the context menu of a .lua file, just create an empty text document and paste that in it:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\.lua]
[HKEY_CLASSES_ROOT\SystemFileAssociations\.lua\shell]
[HKEY_CLASSES_ROOT\SystemFileAssociations\.lua\shell\Run as lua]
#="&Run as lua"
"icon"="C:\\Windows\\system32\\imageres.dll,236"
[HKEY_CLASSES_ROOT\SystemFileAssociations\.lua\shell\Run as lua\command]
#="cmd /k lua "%1""
Then change the extension from .txt to .reg and double click on the file. The option will be added to your context menu.
If you wish to remove it, just do Win+R and type regedit then navigate to HKEY_CLASSES_ROOT\SystemFileAssociations\.lua and remove the shell key (or folder if you prefer)

Windows: How to make command line prompt open at a different path? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I want to change the properties of Windows that when I open a command line prompt window, it will be opened at another path that the current one. Do you know how to do it?
You can create a shortcut to cmd.exe. Then do this :
Right click on Command Prompt > Properties > Shortcut. There you'll see a line which says Target: ". There just specify in which folder you want the cmd to start in.
Where you need to be, after accessing Properties
If you add /k cd "\path\to\folder" to the Target field (after cmd.exe), the resultant Command Prompt window will execute the cd command and then leave you with a prompt to do with as you please. If you need to change to a different drive, you'll need cd /d rather than just cd. If you need to change to a network drive, use pushd instead - it automatically mounts the target UNC path as a drive and changes to it.

Command Prompt not displaying the Current Directory before prompt [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Whenever I run command prompt, it works fine but is not showing the current directory before the prompt(blinking).How can this be solved?
1.) Open up registry editor by typing "regedit" [without the quotes] in the search box, and then clicking on the link up top.
2.) Navigate to the key HKEY_CURRENT_USER \ Software \ Microsoft \ Command Processor and search for the string "Autorun" in the left window. If that string is not existing yet, create it. Double-click it afterwards and add the new directory path in the following way: CD /d C:\
3.) If you would like the command prompt to open in the system32 folder, use this string instead:
CD /d C:\windows\system32
It solved mine!

Wildcard (*) in the path don't work while copying from cmd [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
The community reviewed whether to reopen this question last year and left it closed:
Original close reason(s) were not resolved
Improve this question
There is a file (abc.txt) in a folder-
C:\vackwrk\24may\abc.txt
and i want to copy that file to another folder using cmd-
G:\work\
I use copy C:\vackwrk\24may\abc.txt G:\work\
this work , but when i am using wildcard it don't work copy C:\vackwrk\*\abc.txt G:\work\ this time output is - The filename , directory name or volume label syntax is incorrect.
Why ? Is there any alternate way to copy using wildcard ?
There is no way to use wildcard while copying from cmd because there will be ambiguity to system if there is any other directory C:\vackwrk\foo\ and C:\vackwrk\bar\,both with a file abc.txt.
But Windows PowerShell lets you to do copy using wildcard very easily , just need to open cmd and enter start powershell.exe copy C:\vackwrk\*\abc.txt G:\work\ or simply open Windows PowerShell and enter PS C:\Windows\system32> copy C:\vackwrk\*\abc.txt G:\work\ .
It works fine , so i think Windows PowerShell is more powerful than cmd.

Resources