Basically I want to use PsExec in order to navigate to a specificar folder in a remote computer and performe "hg update branch". I've tried to create the following batch but I'm not able to perform the command:
psexec cmd.exe /c "cd C:\Project\hg update Test"
It's reading as the "hg update Test" was a folder instead of command to be done... I'm tilting over here and this seems like a basic thing :(. How do I pass the "hg update branch" as cmd command through PsExec?
You don't need to change directory, just tell HG what path to operate in:
psexec cmd.exe /c "hg update -R C:\Project\ Test"
The help says:
-R --repository REPO repository root directory ...
Related
I'm having an issue with a Drone CI pipeline step. I'm trying to run some commands on a remote Windows server using the appleboy/drone-ssh image, but I'm encountering an issue where some commands are not executing.
Here's an example step that's failing:
- name: '部署到Web' image: appleboy/drone-ssh settings: host: 192.168.50.249 port: 22 username: administrator password: from_secret: pws_web script: - echo "Web Master" - ls
When I run this step, the echo command works correctly and outputs "Web Master" to the console, but the ls command does not seem to have any effect.
I've tried different commands, such as dir, but they all exhibit the same behavior. I know that the SSH connection is working because I'm able to run echo without any issues.
Can someone please point me in the right direction on how to troubleshoot this issue? I'm not sure if this is an issue with the SSH connection or with the command that I'm running.
Thank you in advance for any help you can provide.
Best regards,
i try many command
all not working
cd d:\hotac
cmd /c git checkout master
cmd /c git pull --tags origin master
powershell.exe -Command "& { Set-Location 'd:\hotac'; git checkout master; git pull --tags origin master}"
I am very new to Docker, so perhaps I am just missing something simple, but I have not been able to figure out a way to accomplish this task.
I have a Dockerfile that looks like this:
FROM mcr.microsoft.com/windows:10.0.17763.3046-amd64
RUN mkdir "C:\Program Files (x86)\Austin Lane Technologies"
RUN mkdir "C:\Program Files (x86)\Austin Lane Technologies\ALMobile Suite"
WORKDIR "C:/Program Files (x86)/Austin Lane Technologies/ALMobile Suite/"
COPY ./BaseInstall/ProgramFiles/ .
WORKDIR "C:/Program Files (x86)/Austin Lane Technologies/ALMobile Suite/bin"
RUN "C:/Windows/Microsoft.NET/Framework/v4.0.30319/installutil.exe" /Logfile=SystemSvc.install.log SystemSvc.exe
RUN "C:/Windows/Microsoft.NET/Framework/v4.0.30319/installutil.exe" /Logfile=DataInterfaceSvc.install.log DataInterfaceSvc.exe
RUN "C:/Windows/Microsoft.NET/Framework/v4.0.30319/installutil.exe" /Logfile=DataSyncSvc.install.log DataSyncSvc.exe
RUN "C:/Windows/Microsoft.NET/Framework/v4.0.30319/installutil.exe" /Logfile=AUServerSvc.install.log AUServerSvc.exe
RUN "C:/Windows/Microsoft.NET/Framework/v4.0.30319/installutil.exe" /Logfile=ADExplorerSvc.install.log ADExplorerSvc.exe
This scripts builds the image:
docker build -t almobile:latest .
I then launch an Admin Powershell Window and do the following:
.\runalmobile_test.ps1, which contains:
docker run --user ContainerAdministrator --name master -v "C:\ALMobileSuiteProgramFiles\Master\ProgramFiles:C:\Program Files (x86)\Austin Lane Technologies\ALMobile Suite" -p 2089:2089 -p 2090:2090 -p 2091:2091 -p 2093:2093 -it almobile cmd.exe
The registry file I want to load resides in the C:\ALMobileSuiteProgramFiles\Master\ProgramFiles directory.
I am able to load the registry of the container with the contents of this file if I manually enter the regedit command from an Admin Powershell window, but what I want to do is to have the regedit import command automatically issued when the container starts. So, once the cmd.exe shell launches, I am in the C:\Program Files (x86)\Austin Lane technologies\ALMobile Suite\bin folder. If I manually issue the following command, all works:
regedit /i /s ..\ALMobile.reg
What is the best practice/way for me to automatically import this registry file at time of container startup? Is there a way to run the regedit command from the Dockerfile, or does this need to be executed from some alternate script?
I think you need to run the Registry file during the docker build step, not the docker run step. And use reg import instead of regedit. So in your Dockerfile, you would have something like this, assuming you are using Powershell:
COPY ALMobile.reg .
RUN Invoke-Command {reg import ALMobile.reg}
I have to zip files on a remote windows machine.
So I first ssh to the windows machine
ssh my_user#my_host "cd /d D:\MyFolder"
And the above command works.
However if I try to run any command after that it fails.
So if I do something like
ssh my_user#my_host "cd /d D:\MyFolder; dir"
The system cannot find the path specified.
You can try something like:
ssh my_user#my_host <<EOF
cd /d D:\MyFolder
dir
EOF
The second EOF should be alone on the line and start from the begin
I executed this command "C:\Program Files (x86)\Git\bin\git.exe" clone ssh://<user>#<org>:<path to repo> in Git bash terminal and in normal command prompt.
When executed in Git Bash terminal, the clone works fine, but while running it in command prompt, it gives following error.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I need to run git clone through windows batch script, that's why
i need to make it run through command line. How to do that work ?
Note :-
1. Add public key to remote(gerrit) that was generated using ssh-keygen.
Your SSH identity is not found while running from command line. Make sure that %HOME%\.ssh directory contains your keys.
I need help in writing chef recipes. I have some jobs in Jenkins and they are done by Execute Windows batch command. I have to rewrite this commands to chef recipe but I can't become familiar with writing these recipes... I need some example of this kind of "rewriting".
For instance, this command:
D: && cd D:\[some path] && pc.exe "\\[some folder]" -u "admin" -p [pass] cmd /c "c: && cd C:\some folders]\ && install.bat"
need to be rewrite to chef reciepe.
I can show other commands if it is needed.
I would by grateful to all kind of help
Something along the line:
execute "install" do
command %Q{pc.exe "\\[some folder]" -u "admin" -p [pass] cmd /c "cd /D C:\some folders] && install.bat"}
cwd "d:\[some path]"
end
should do.
Without any insight on what does this command at all, it's hard to give a better advice, as for the placeholders, using attributes should be the way to go, but it's hard to tell without an entry point.
More details in the documentation