Using the registry I used the following code below to create a sub-menu in the windows context menu.
[HKEY_CLASSES_ROOT\DesktopBackground\Shell\Power Menu]
"MUIVerb"="Matt's Usefull Tools"
"SubCommands"="batmode;logoff;switch;sleep;hibernate;restart;safemode;shutdown;hybridshutdown"
"Icon"="C:\\Users\\Matthew\\Downloads\\Hacker.ico"
"Position"="bottom"
Now I want to be able to click a command I set and then have it create a .bat file where I right clicked, I know you can add this to the "New" sub menu by editing the ".bat" registry using the code.
[HKEY_CLASSES_ROOT\.bat\ShellNew]
"NullFile"=""
Now is it possible to implement this into my sub-menu?
i could get this only to work w/ following command:
CMD.exe /c #ECHO.>"%V\New File.bat"
Under HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\Shell\batfile\command
where "batfile" must be one of your "SubCommands".
the issue is, that this will always create the "New File.bat" in current location (e.g. Desktop).
If there's an existing "New File.bat" it will just overwrite it.
If you use CMD.exe /c #ECHO.>>"%V\New File.bat" and there's an existing copy of "New File.bat", it will just add whitespace to the file.
i do not know a way to Call "ShellNew" from "command". :/
Maybe it helps anyway.
Edit:
whoops... just saw that this is an one year old question ^.^
anyway - it may help somebody else. :)
Related
How do I delete/remove the "Error.error" file when the system says it is not there but it is?
The Error.error file was created somehow and I do not know why or how. However, the issue is the system has created this 0 byte file called "Error.error" and it cannot be deleted, even if I try a "permanent" delete command. It also will not allow me to delete any of the folder directory hierarchy in which is resides. When I do try create it, rename it, or create a physical file with the same name and extension, or try to delete this file directly or indirectly I receive the following error message:
"Could not find this item: This is no longer located in C:\maps\test. Verify the items location and try again." Then it list "Error.error" and its information. However, it is there visually.
Any thoughts or suggestions on how to remove or correct?
Thanks!
I had a very similar issue not too long ago where I had a file that was created by another program and whenever I tried to access or delete it, windows would give an error message like "...This is no longer located in...".
If you're having the same problem I was, here's how I got rid of the file. Start a command prompt. In the command prompt, enter a command like del "\\?\<full path to file>". So if your file name is "Error.error" and it is located in the folder "C:\maps\test", the command you would enter is
del "\\?\C:\maps\test\Error.error"
You can delete a folder that windows won't let you access in a similar way by changing the command from "del" to "rd /S".
If you don't know how to start a command prompt, simply click the start button and type "command". The start menu should offer an option named something like "Command Prompt - Desktop app". That's what you need to start.
I found a good explanation of what the "\\?\" means here.
I need to pin an executable into the new Windows 10 start menu (i.e. creating a tile).
I'm aware of PowerShell scripts that do the job, but I need some instructions to add at the end of an existing batch file (cmd) we already use for installing our applications.
The usual scripts (valid for Windows 8 and 8.1) simply don't work. How can I do this?
This is a kludge work around that Microsoft needs to fix, but it worked for me.
Temporary rename the .bat file to .exe. Then right click on the file name. It will give you the Pin to start option. Pin it to the start menu. It won't work, but there is an option open the file location. Select that and change the name back to .bat. Now it works.
The way it works on Windows 10 after trying almost 15 different methods that didn't work for me
Go to your desktop -> right-click -> Create New Shortcut
In the shortcut target type the following text:
cmd /c "full path to your batch file"
It will look something like this:
cmd /c "C:\Users\Jmeter\Desktop\jmeter.bat"
Name the shortcut.
Right-click on the shortcut -> select Pin to taskbar. If you'd prefer it pinned to your Start menu, select Pin to start instead.
Bonus: Download some .png image -> Go here (https://icoconvert.com/) -> convert to Windows icon file -> set as new icon
Note: I've wrote and tested this on windows 8 - you might face issues on windows 10.
Check this. This a JScript/bat hybrid that uses the shellapplication object and invokeverb function (i.e. emulates right click and chooses some specific actions). It is now compatible with Windows 10.
Use it like this (you can use also a shortcut/.lnk to an exe):
call pinnerJS.bat "%windir%\system32\cmd.exe" startmenu
Follow my original method, and you will get .bat file{s} pinned in Taskbar. WORKS 100%
Step 1: Create shortcut of your .bat file (for example in Desktop “C:\Users\youruser\Desktop\yourfile.bat”). So you will end up with “yourfile.bat – Shortcut.lnk” (you might not see extension “.lnk”).
Step 2: Right Click your shortcut and change your Target field from: “C:\Users\youruser\Desktop\yourfile.bat” to: explorer “C:\Users\youruser\Desktop\yourfile.bat” – note: explorer is the explorer.exe app. You can also write the full Path: C:\Windows\explorer.exe, for no confusion.
Step 3: Now Right Click your shortcut and now you can see the option Pin to Taskbar.
Step 4: Right Click the pinned shortcut, and you will see two options: shortcut itself and unpin option. Right Click the shortcut and select Properties. From Target field delete “C:\Windows\explorer.exe” and leave only “C:\Users\youruser\Desktop\yourfile.bat”, and click OK
Now you can delete your shortcut in Desktop, since now you have your standalone shortcut on Taskbar
Optionaly, if you want to change Icon do Step 4, but now click “Change Icon…” button, and choose your custom Icon, from some other exe file or .ico file.
That’s it!
Now you have fully functional batch file shortcut on Taskbar
Right now, you can't do this with free tools (maybe Windows want to get into the "pay2tile" business model).
One possible option at the moment would be to use Classic Shell.
I download a file from http://msysgit.github.io/. The file got on to my harddrive without any problem. But now I can't move it, delete it, or even do anything with it. It seem like it crash right on the spot. How do I remove it from my pc?
First I tried moving the file and it did nothing. It just sit there a 0%. So I try stopping it. It didn't work. I relog in to my window. Than I try delete it. Same problem as before. I right click on file and than I click on properties. Nothing has happened.
From here: this manual page To power through you might need to open the command prompt as an administrator. I do that by clicking on Start, then in the "run" box I type "cmd". You will see cmd.exe show up. Right-click on it and choose run as administrator.
Here is the command to force delete a file that is read-only:
DEL /F C:\examples\MyFile.txt
Here is another interesting quote from that page:
Undeletable Files
Files are sometimes created with the very long filenames or reserved
names: CON, AUX, COM1, COM2, COM3, COM4, LPT1, LPT2, LPT3, PRN, NUL
To delete these use the syntax: DEL \.\C:\somedir\LPT1 Alternatively
SUBST a drive letter to the folder containing the file.
If a file (or folder) still appears to be 'undeletable' this is often
caused by the indexing service. Stopping the service will often enable
the file to be deleted.
I found a way. I used cmd and did a force delete. For other who have this problem:
Force delete using Windows
Enter the command prompt (Start-> Run-> Cmd). use cd
/d {path to folder}. than do enter ‘del {filename}’. Give it about 5min or less...
I'm using cl in cmd and having to run vcvars32.bat every time I open a cmd window is really a pain in the axx. Can anyone offer a way of running it automatically?
From cmd /?:
If /D was NOT specified on the command line, then when CMD.EXE starts, it
looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
either or both are present, they are executed first.
HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun
and/or
HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun
You therefore could add vcvars32.bat to one of those AutoRun registry values to have it executed for every cmd.exe instance (except when /D is explicitly specified, of course).
However, be forewarned that doing this could result in other weird side-effects (for example, it could cause other .bat/.cmd scripts to be run in an environment that they aren't expecting).
A workaround that works for some people is to write a batch file and call it A.BAT and make a.bat launch vcvars32.bat. Put a.bat on the path and then it's a matter of opening the cmd prompt and typing a and enter and voila, you're set!
way old, but the easiest way to do this with, say, a shortcut created on your TaskBar is to modify your shortcut (in %appdata%\microsoft\internet explorer\quick launch\user pinned\taskbar, or thereabouts) so the target is:
%windir%\system32\cmd.exe /k vcvars32.cmd
that'll do exactly what you're looking for. The /k tells it to execute the string but keep the window open (string being your batch file). You can either put vcvars32 somewhere in your path, or specify the whole path to vcvars32.
You can use the script in http://www.alteridem.net/2010/09/02/visual-studio-2010-command-prompt-here to make it so when you right-click a folder in explorer the option shows up. After downloading and extracting the zip file you can modify the .inf to point to the correct path to your particular VS version (and change the displayed name if desired). Note the comment on the page about having to rename the file if you are running 64-bit Windows.
I am new to php and cake php. I am attempting to bake up some cakephp code in the Windows Command Prompt. When I do the command "cake bake" within C:\xampp\htdocs\cake\lib\Cake\Console, I get no result, just a blinking cursor. Has anyone else ever had this happen or have any suggestions that might be helpful?
Go to the dir C:\xampp\htdocs\cake\app.
I don't know which version of Windows you have. However, you must access Environment Variables Access it by any mean.
In Windows7:
Right Click on Mycomputer-> Properties -> click on Advanced System Settings -> The last button Environment Variables is there, click on it From System Variables list select Path and then press Edit button. You will see a line of code, at its end add something like the following:
;C:\xampp\htdocs\cakephp\cake\console\;C:\xampp\php
The first path is the path in-which cake.bat file is found
The second path is the path in-which php.exe is found.
Restart your coputer and you will find cake bake works fine at any directory you want.