trouble with cake.bat - cakephp

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.

Related

How do I remove an Error.error file being created and cannot be deleted?

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.

How to open cmd and execute command using bat file?

As i am new to JAVA programming, I used to compile and run classes using Command Prompt. But I am lazy to open and set paths every time in CMD. I found that can set the folder's path automatically using a batch file by placing it in the folder that i want to specify. But I dont know how to set the path of the jdk bin folder using bat file.
I just typed set path=%path%;C:\Program Files\Java\jdk1.8.0\bin but no hope.
So please can you guys tell me what is the code for do that. Thank you.
Assuming that
(1) You want to set path to JDK bin AND (2) the path must be available even after the batch file terminates.
In such a case, please consider setting it this way:
https://java.com/en/download/help/path.xml
Windows 8
Drag the Mouse pointer to the Right bottom corner of the screen
Click on the Search icon and type: Control Panel
Click on -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
Windows 7
Select Computer from the Start menu
Choose System Properties from the context menu
Click Advanced system settings > Advanced tab
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Reopen Command prompt window, and run your java code.
Windows XP
Start -> Control Panel -> System -> Advanced
Click on Environment Variables, under System Variables, find PATH, and click on it.
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Close the window.
Reopen Command prompt window, and run your java code.
Windows Vista
Right click My Computer icon
Choose Properties from the context menu
Click Advanced tab (Advanced system settings link in Vista)
In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
Reopen Command prompt window, and run your java code.
UPDATE: Quoted from website, as per suggestion by #Brian Tompsett

How to pin to start menu using a batch file (Windows 10)

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.

How can I make a Windows Form pass a command to the console/command line?

I have created a new Windows Forms Application
Looks like picture (simplified)
...
Also I have a command line program (python)
It is saved in path as "myApp"
To run it, just need to type "myApp" (and pass it options) on command line
...
This is great, but I also want someone not familiar/comfortable with command line to
be able to use the program. Hence the form.
...
So question is, how can I set it up, such that on button click,
the form does the equivalent of typing directly to command line ??
...
I think this is possible because if I start a New Console Application, and code
system("myApp");
It does exactly this
...
However when I use the 'system' code in Windows Forms, I get a
'system': identifier not found
error
You can use System.Diagnostics.Process.Start method to run any Windows cmd command, like starting it from the command line.
Sample code:
System.Diagnostics.Process.Start("py script.py");
MSDN Official Documentation
You should use the Process class with an appropriately set up ProcessStartInfo. There's a detailed example at ProcessStartInfo
If thats the case i think we will have to do it the hard way.You could compile a seperate dll in visual studio to do exactly what your console application did,like
system("fileneme")
and then set it to dynamically link with your form application at run time, and hopefully you will get it right.

remove file path in terminal and just display a folder

So to get started with my work I usually have to cd into a specific folder in iterm2.
Sorta looks like this [johnson#david-MacBook-Pro /Applications/MAMP/htdocs/demoapp] 16:41:32 $
As you can see that takes up a ton of room in the damn window. How do I remove the name of the path and just have it so its like this
demoapp ->
I've seen this in video tutorials where the only thing on the screen is the name of the folder or directory the person is in without all the extra info.
Obviously this a Mac specific question. Is it possible to toggle between showing full path and just specific path for quick reference?
thanks!
When one uses a Terminal (in Linux or Mac) initiated as root, only the actual directory is shown. In my case (using Linux Mint), if I start a normal Terminal, and use the command su to login as root, the complete path changes to the actual directory.
Try this:
a) write su on the Terminal
b) enter...
c) it asks for the root password, write it and press enter again.

Resources