Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

How can I execute a command inside a command on command prompt

  • 16-03-2006 11:15pm
    #1
    Closed Accounts Posts: 201 ✭✭


    Is there a way to execute a command inside a command on command prompt in windows

    specifically i will have a path written to a file and I would like be able to execute a cd command to open that path something like

    cd type path.txt

    where the type path.txt command executes first and then cd runs on that


Comments

  • Registered Users, Registered Users 2 Posts: 2,560 ✭✭✭optiplexgx270


    batch file? otherwise piping


  • Closed Accounts Posts: 201 ✭✭bazcaz


    cd | type path.txt

    just prints the contents of the file way am I doing wrong??


  • Registered Users, Registered Users 2 Posts: 2,560 ✭✭✭optiplexgx270


    thats the wrong way round for a start u could use a batch file


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 94,272 Mod ✭✭✭✭Capt'n Midnight


    To list all the files in the windows dir with an E in their name

    dir > dir.txt & find /i "e" dir.txt > e.txt & notepad e.txt


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    What are you trying to do exactly? Are you trying to store that path so you can go back there at a later date?

    If so do something like this..
    :We are at start directory
    pushd workdir
    
    :We are in the workdirectory and have stored the start directory.
    :** Do work here..
    
    :popd
    
    :We are now back in the start directory. 
    

    If you must go with a file method then this should work..
    :create the path.txt file. 
    cd > path.txt 
    
    :This will change directory to the path listed in the file.
    FOR /F "tokens=1" %v IN (path.txt) DO cd %v
    


  • Advertisement
Advertisement