Windows implementation in the bat start s h e l l

  
        Because you need to use cygwin to perform daily scheduled tasks, there is a cygwin installation time task to complete. However, it may be more troublesome under Windows. Considering that Windows has its own scheduled tasks, if you can make a scheduled task, start the application on time every day, or bat script. Because the script is a shell script, it cannot be directly executed under Windows, only through cygwin. So you must start cygwin in bat now, write the bat file: 1 @echo off 2 rem change to d: 3 d: 4 rem change the dir 5 chdir D:\\cygwin\\bin 6 echo "begin..." 7 rem 8 D:\\cygwin\\bin\\mintty.exe /home/scripts/webFunc There is a problem: after starting cygwin, the command cannot be run, which has been bothering for several days. I don't know why the shortcut can be run directly, but I can't find the commands such as ls, find, mkdir and rdquo; . At first I thought it was necessary to pass some parameters to cygwin in bat, check its shortcuts, and found no special parameters. I realized that it was a problem of environment variables until now, so I added cygwin\\bin after the path of the environment variable; the problem was solved. A small place to pay attention to, my shell script is useful for find, and windows find is also available. So the system uses the find command under Windows by default, so it always reports an exception of "Parameter error". After changing the find in the shell to /user/bin/find, the problem is solved. Fortunately, my script is not much, and the find is used in two or three places. Execute normally after the change. The other is the use of mysql in the script, so you need to install mysql and add environment variables. Porting from linux to windows, it sounds very simple things, there are still a lot of problems encountered when doing, there is a problem is the problem of the path in the code. When the students who wrote the code all wrote the path to find the configuration, /home/... Now transplanted to it, as long as you manually change it to Windows. Pay more attention in the future, and try to follow the posix standard as much as possible.
Copyright © Windows knowledge All Rights Reserved