我正在尝试编写一个bat文件,打开cmd
更改目录,然后开始进行操作。
这是我到目前为止所拥有的。它将打开cmd
并更改目录,然后打开 second start cmd /k cd /D C:\Development\project\X.WebApp
start yarn start --port 4201
窗口并在原始目录中运行yarn命令。
cd
但是我想cd
到目录并在start cmd /k cd /D C:\Development\project\X.WebApp yarn start --port 4201
目录的同一 cmd 窗口中执行yarn。
C:\Program Files (x86)\Yarn\bin\yarn
C:\Program Files (x86)\Yarn\bin\yarn.cmd
C:\Program Files (x86)\Yarn\bin\yarn.js
纱线在哪里
<VirtualHost *:80>
ServerName localhost
RewriteEngine on
#ErrorLog "logs/authproxy-error_log"
#CustomLog "logs/authproxy-access_log" common
Session On
SessionCookieName session path=/
SessionCryptoPassphrase secret
<Location / >
#LDAPReferrals off
AuthType form
AuthName GrafanaAuthProxy
AuthFormLoginRequiredLocation https://192.168.0.1/abc/go/login.html
#AuthBasicProvider ldap
AuthFormProvider ldap
AuthLDAPURL "ldap://192.168.1.10/DC=demo,DC=com?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN "grafana@demo.com"
AuthLDAPBindPassword "Demo123#"
Require valid-user
Require ldap-user grafana
Require ldap-group *
Session On
SessionCookieName session path=/
SessionCryptoPassphrase secret
</Location>
<Location "/abc/go/login.html">
Order allow,Deny
Allow from all
require all granted
</Location>
<Location "/abc/go/dologin.html">
SetHandler form-login-handler
AuthType form
AuthName GrafanaAuthProxy
AuthFormProvider ldap
AuthFormLoginRequiredLocation https://192.168.0.1/abc/go/login.html
Session On
SessionCookieName session path=/
SessionCryptoPassphrase secret
</Location>
<Proxy *>
RewriteEngine On
RewriteRule .* - [E=PROXY_USER:%{LA-U:REMOTE_USER},NS]
RequestHeader set X-WEBAUTH-USER "%{PROXY_USER}e"
</Proxy>
RequestHeader unset Authorization
ProxyRequests Off
ProxyPass /grafana/ http://localhost:3000/
ProxyPassReverse /grafana/ http://localhost:3000/
</VirtualHost>
当前我要做的事情
我希望将所有这些文件保存在一个bat文件中,这样我可以启动该文件并为我完成所有这三件事,而不是我必须一直键入此文件。我不喜欢在单行命令中使用它。
答案 0 :(得分:1)
您似乎想在同一窗口中启动纱线,而不是打开新窗口。
@echo off
cd /D "C:\Development\project\X.WebApp\"
start "" /b yarn start --port
pause
答案 1 :(得分:1)
对于您提到的问题,我会忘记显式更改目录,而利用已经在使用的Start
命令的选项,特别是/D
选项。
Start /B /D "C:\Development\project\X.WebApp" Cmd /K "yarn start --port 4201"
答案 2 :(得分:0)
在Windows批处理文件中,您可以使用@
依次运行命令:
public static void main(String[] args) throws IOException {
BasicFileAttributes thisFileBasicAttributes = null;
Path pathOfThisFile = Paths.get("/myKey.store");
System.out.println(pathOfThisFile);
try{
thisFileBasicAttributes = Files.readAttributes(pathOfThisFile, BasicFileAttributes.class);
Object fileKeyBasic = thisFileBasicAttributes.fileKey();
String output = "Basic: " + fileKeyBasic.toString();
System.out.println(output);
}
catch(IOException exception)
{
System.err.println("JVM reported an exception, please take a look at" + exception);
}
}
如果cd命令成功,则将运行yarn命令。