Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8080101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:19:04+00:00 2026-06-05T16:19:04+00:00

so currently what I am attempting to do is, remote onto a different server,

  • 0

so currently what I am attempting to do is, remote onto a different server, launch a scheduled task, exit, change to a specified folder on my desktop, write a file

My code currently looks as such

C:MyOriginalFolder> psexec \\MYREMOTESERVER -u MYUSERNAME cmd
C:MYREMOTESERVER> SCHTASK.......
C:MYREMOTESERVER> exit & cd C:\\Users\ce132d & echo "Logged off" > MyLog.txt
//expected: the folder C:\\Users\ce132d should have a text file called MyLog.txt

//what happens:  I end up in C:MyOriginalFolder with no MyLog.txt file created

When I remove the &’s and test it command by command, all is dandy and the expected behavior happens. But when linking them together with & and &&, the expected behavior does not happen.

So my question is this: is there some way of one-lining the actions of exiting, changing directory, and writing a text file?
I am eventually going to check if loging into the remote server was successful or not, and want to put those 3 actions into a if (successful login) {do 3 tasks} else {write error log}..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T16:19:06+00:00Added an answer on June 5, 2026 at 4:19 pm

    You send your remote server exit & cd C:\\Users\ce132d & echo "Logged off" > MyLog.txt.
    Why do you expect that the cd ... should have any effect on your local directory?

    When you send the commands line by line then your exit will EXIT the remote server context, then you are again on your local machine, therefore the rest of the commands works as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently attempting to get remote desktop server access to a different server,
I am currently attempting to change the css of specific dates inside a jQuery
I'm currently attempting to use PHP to transfer small files between our server and
I am currently attempting to implement a custom gridview interface to display data from
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt.
I am currently attempting to use Lucene to search data populated in an index.
I'm currently attempting to code one for part of a college project - binary/hex
I am currently attempting to push html updates to a page for a user
How do I force a 32-bit build of Boost with GCC? Currently attempting by
I am currently having problems with attempting to style the HTML rich text editor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.