Bound cmd as default program for JS files - file

I have the following problem. For some reason (I wanted to try something) I set the command prompt (C:\Windows\System32\cmd.exe) as the default program (right click JS-file, properties, opens with -> change... ).
Now, for some reason, I can't change it back to an other program. The option of doing so in the file options has disappeared. Any way to change it back to normal?
Thanks,
Ruben.
EDIT:
output of reg query hkcr\jsfile\shell /s:
HKEY_CLASSES_ROOT\jsfile\shell
(Default) REG_SZ Open
HKEY_CLASSES_ROOT\jsfile\shell\Edit
HKEY_CLASSES_ROOT\jsfile\shell\Edit\Command
(Default) REG_SZ C:\Windows\System32\Notepad.exe %1
HKEY_CLASSES_ROOT\jsfile\shell\Edit with Adobe Dreamweaver CS5.5
HKEY_CLASSES_ROOT\jsfile\shell\Edit with Adobe Dreamweaver
CS5.5\Command
(Default) REG_SZ "C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5.5 \Dreamweaver.exe","%1"
HKEY_CLASSES_ROOT\jsfile\shell\Open
HKEY_CLASSES_ROOT\jsfile\shell\Open\Command
(Default) REG_SZ "C:\Program Files (x86)\Adobe\Adobe Dreamweaver CS5.5 \dreamweaver.exe","%1"
HKEY_CLASSES_ROOT\jsfile\shell\Open\ddeexec
(Default) REG_SZ
HKEY_CLASSES_ROOT\jsfile\shell\Open2
(Default) REG_SZ Open &with Command Prompt
MUIVerb REG_SZ #C:\Windows\System32\wshext.dll,-4511
HKEY_CLASSES_ROOT\jsfile\shell\Open2\Command
(Default) REG_SZ C:\Windows\System32\CScript.exe "%1" %*
HKEY_CLASSES_ROOT\jsfile\shell\Print
HKEY_CLASSES_ROOT\jsfile\shell\Print\Command
(Default) REG_SZ C:\Windows\System32\Notepad.exe /p %1

Open a cmd box and use ASSOC and FTYPE.
Output on my Windows 7 system:
C:\Windows\System32>assoc .js
.js=JSFile
C:\Windows\System32>ftype jsfile
jsfile=C:\Windows\System32\WScript.exe "%1" %*
Using ASSOC, you can find out which filetype is associated to .js
Assuming "JSFile", you can use "ftype jsfile" to find the command defined as default for JSFile. "ftype /?" explains how to change the command.

Related

How to add string value to Windows registry?

I want to add this new registry entry via cmd/batch file to run CMD always as administrator. I know I can add it by navigating to the mentioned path in the command. But I want to add it in one of my batch files. And I think to add string value I need to modify my cmd. I am missing something here :-
reg.exe ADD \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers /t REG_SZ "C:\\WINDOWS\\system32\\cmd.exe"="RUNASADMIN" /f
Can anyone help me with this please?
The command line to use in a batch file executed by 64-bit cmd.exe on Windows x64 or 32-bit cmd.exe executed on Windows x86 running under elevated environment of a local administrator is:
%SystemRoot%\System32\reg.exe ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /f /t REG_SZ /v "C:\WINDOWS\system32\cmd.exe" /d "RUNASADMIN"
Open a command prompt window and run reg /? and next reg add /? for help on used command REG for adding a string value to Windows registry.

Delete files in context menu with bat file windows 8

my bat file:
#echo off
set targetfolder=%1
cd /d %1
del .
pause
my delete.reg file
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\Run Batch script]
#="Delete all"
[HKEY_CLASSES_ROOT\Directory\Background\shell\Run Batch script\command]
#=C:\delete.bat \"%V\"
The option is in the context menu but if I click Im getting this error:
This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel.
[OK]
You don't really need a batch file, you should be able to run a command directly from the registry key.
Example:
#ECHO OFF
SETLOCAL
SET "SKEY=HKCU\Software\Classes\"
SET "EKEY=\shell\DeleteAll"
REG ADD %SKEY%Folder%EKEY% /VE /D "Delete &All Files" /F>NUL
REG ADD %SKEY%Folder%EKEY%\command /VE /T REG_EXPAND_SZ /D^
"%%COMSPEC%% /C PUSHD %%L && DEL *.*" /F>NUL
Right-click on a folder and select 'Delete All Files' to delete all normal files within that folder. (Be careful this will be catastrophic if you select the wrong folder)

Manipulate registry settings on a Win CE 7 System with a Batch file

I got a problem with manipulating my registry settings. I use a Panel PC with windows embedded compact version 7 (Win Ce). I want change the display-brightness, which is set on "HKEY_CURRENT_USER\ControlPanel\BackLight", by a BAT file. I use following syntax:
reg add "HKCU\ControlPanel\BackLight" /T REG_DWORD /F /D 150 /V ACBacklightLevel
But when I run the file, the error message : "Cannot execute reg.exe"
I tried the Bat File on my PC with windows 7. It works correctly.
Is there a problem with the command "reg add" on Win CE systems? Did i make another mistake?
Thanks in advance
Frank
edit:
I´m not sure if this is important, but I use in the header of my BAT file the line "REGEDIT4". I read in other forum that it is for WIN98, NT and 4.0. But there isn´t any command fpr windows CE. Do you know what it does?
edit 23.04.2015:
I created a .reg file, which increases the brightness of my HMI. It worked when I import it manually. Is it possible to import it automatically via Batch file or something like that? someone know the syntax of this command or got another idea how to do this?
the correct command line is (you must use the cmd):
REG ADD "HKCU\Control Panel\BackLight" /v "ACBacklightLevel" /t REG_DWORD /d 150 /f
for the next time:
REG ADD "Register key name" /v "key name" /t "type" /d "type value" /f

Add registry from bat file

I am trying to add registry entry from bat file. I have a reg file that contains
[HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer\Control Panel]
"HomePage"=dword:00000001
It works if you double click the reg file. However, I need to make the same registry edit from bat file. I have tried this
reg add HKCU\Software\Policies\Microsoft\Internet Explorer\Control Panel /v HomePage /t REG_DWORD /d 0 /f
But doesnt work. What is the correct way to do that ? (except running .reg file from bat file)
Put quotes around the key name.
reg add "HKCU\Software\Policies\Microsoft\Internet Explorer\Control Panel" /v HomePage /t REG_DWORD /d 0 /f
Because "Internet Explorer" and "Control Panel" contain spaces, you need quotes so it is all treated as one parameter.

Change regional and language options in BATCH

How can I change the regional and language options in Windows XP and 7 using batch code?
I want to change the "Standards and formats" to Mexican Spanish with a .bat file.
Those settings are in the registry under HKCU\Control Panel\International
You can use reg.exe to make the changes manually. The easiest way to do that is to manually change your region and language to spanish (mexico) open a cmd window and type reg query "HKCU\Control Panel\International" which will show you the values as you want them. Then to modify them, use REG ADD "HKCU\Control Panel\International" /t REG_SZ /v LocaleName /d es-Mx /f for each value replacing what is after /v with the appropriate name and what is after /d with the appropriate value.
The other option is to just export the HKCU\Control Panel\International hive to a .reg file and just import it into the registry using regedit /s ImportFile.reg
You may need to refresh the registry after the import to see the changes. This usually involves a reboot but try adding the following as the last line in your batch file instead. RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True

Resources