Change directory

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 1036 Views - Last Post: 19 November 2019 - 01:32 PM Rate Topic: -----

#16 mouseluxi   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 25-February 18

Re: Change directory

Posted 14 November 2019 - 12:15 AM

View PostSkydiver, on 07 November 2019 - 06:30 PM, said:

This:
std::string change;
std::cin >> change;


Is simply:
string change = Console.ReadLine();


You should recall this from your Popmachine thread.

_chdir() is simply a matter of setting the Enviroment.CurrentDirectory.

Thanks you so much.
Was This Post Helpful? 0
  • +
  • -

#17 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7135
  • View blog
  • Posts: 24,240
  • Joined: 05-May 12

Re: Change directory

Posted 14 November 2019 - 04:52 AM

View Postalbert003, on 13 November 2019 - 11:48 PM, said:

Skydiver
I know I could do it in command and its not hard to do. I wanted to make it user friendly as an easy program to make for my new job and use C#.


That code I used is in C#. Environment.CurrentDirectory doesn't care if your code is running as a Console, WinForms, WPF, Xamarin, WebForms, or Xamarin. I used console just because you started this thread asking about the C# equivalent for your C++ code, and then later complained that it wasn't working when running as administrator.
Was This Post Helpful? 1
  • +
  • -

#18 albert003   User is offline

  • D.I.C Addict

Reputation: 37
  • View blog
  • Posts: 791
  • Joined: 15-December 14

Re: Change directory

Posted 18 November 2019 - 07:38 PM

I didn't peek at your spoiler to solve the problem. I solved the problem by realizing there was a difference when I opened cmd and cmd as administrator. I didn't realise there was a difference how they appeared when run.

Once I realised the difference I was able to make the program work the way I wanted. This is how I solved it. Since I keep getting blocked when I try to post my code I will post the outcome of my code that appears on cmd.

I was able to figure out how to run chkdsk but I cannot seem to get defrag to work when I run cmd as administrator.
Arguments = "defrag " + dir;
to work.

Choose an option:
1.Copy file
2.List of files
3.Device maintenance
4.Exit
3
1.C:
2.D:
3.E:
4.F:
Which directory do you want to run check disk?
F:
The type of the file system is FAT32.
The volume is in use by another process. Chkdsk
might report errors when no corruption is present.
Volume Serial Number is xxxx-xxxx
Windows is verifying files and folders...
File and folder verification is complete.

Windows has scanned the file system and found no problems.
No further action is required.

4,002,529,280 bytes total disk space.
65,536 bytes in 4 hidden files.
278,528 bytes in 17 folders.
10,616,832 bytes in 67 files.
3,991,552,000 bytes available on disk.

16,384 bytes in each allocation unit.
244,295 total allocation units on disk.
243,625 allocation units available on disk.
Choose an option:
1.Copy file
2.List of files
3.Device maintenance
4.Exit

This post has been edited by albert003: 18 November 2019 - 08:39 PM

Was This Post Helpful? 0
  • +
  • -

#19 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7135
  • View blog
  • Posts: 24,240
  • Joined: 05-May 12

Re: Change directory

Posted 18 November 2019 - 09:27 PM

OMG! No wonder we were having a communication problem. Those choices are for drives, not directories. Yes, it makes a difference which drive you are currently on when you run Chkdsk or Defrag.

On the flip side though, I hope you do realize that both Chkdsk and Defrag can take a drive letter as a parameter so that you don't have to have your current drive be the one that is targeted by those applications. In other words, we wasted all this time trying to figure out the issue about changing drives as admin vs not admin not working for you.

As for being unable to post code, the forum has a bug where its security measures prevents posting code that uses the substring method. If your code uses it, then your post will be blocked.

I highly suggest learning how to use git properly so that you can share your code and get better feedback.
Was This Post Helpful? 0
  • +
  • -

#20 albert003   User is offline

  • D.I.C Addict

Reputation: 37
  • View blog
  • Posts: 791
  • Joined: 15-December 14

Re: Change directory

Posted 19 November 2019 - 12:03 PM

SkyDiver
I'm sorry I had a dumb moment. I do appreciate your help and I am going to use this weekend to learn how to properly use github.

I wanted to remake the code and put it in azure so I could access it anywhere at the office and be able to fix the computer problems. Their current 'network' was created using remote desktop and I don't trust their 'IT' guy to not mess up my laptop or program.

I remember I had the same problem when I was writing a code in c++. Dreamincode wouldn't let me post it because it was too big.

This is the link of my program on github


https://github.com/a...tenance-program

This post has been edited by albert003: 19 November 2019 - 12:26 PM

Was This Post Helpful? 0
  • +
  • -

#21 Skydiver   User is online

  • Code herder
  • member icon

Reputation: 7135
  • View blog
  • Posts: 24,240
  • Joined: 05-May 12

Re: Change directory

Posted 19 November 2019 - 01:32 PM

Congratulations! You got to upload files into GitHub!
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2