run as admin CMD window bad workdir and crazy small font

McVitas

Member
Member
Messages
15
Hello, this is something strange and I think quite badly implemented. I almost don't want to spend my time to hack it to work somehow anymore :-]
I want a BAT file which mounts a truecrypt volume on a usb drive to be run as admin. Allright so I right click on it and do run as administrator, BUT it changes it's working directory to c:\windows\system32 so it cannot find the executable which it tries to call. So I thought OK I will create a shortcut for this on the desktop for example and set the workdir to e: (it is on that usb drive) which is already not very good practice because the drive's letter can be different next time thus it would not work, BUT in this case it still does not work, goes to c:\windows\system32 and also the font is set to the smallest possible so it is barely readable. Is there a way to set workdir for "as administrator" processes or some other obvious way to do this which I did not think about? Also I would really like to know how (the heck) do I change the font in this administrator cmd window permanently. I did runas cmd window and changed it there but it remains the same when starting this shortcut.
Qf0DLoq.png
 
Last edited:

My Computer

System One

  • OS
    Windows 8.1
right click on the shorcut choose properties, and click the Compability tab. chooes the option "Run this program as Administrator"
 

My Computer

System One

  • OS
    Windows 8.1 Enterprise (64 Bit)
    Computer type
    Laptop
    System Manufacturer/Model
    ACER-AO756
    CPU
    Intel Celeron CPU 877 @1.40Ghz
    Motherboard
    ACER MIMIC
    Memory
    DDR3
    Graphics Card(s)
    Intel HD Graphics
    Browser
    IE 11 and Firefox 29
    Antivirus
    AVG Internet Security
You write your .bat file in Notepad. Then place it in the Startup folder in All Programs. As for mounting Truecrypt all of the time. Keep in mind that if something goes wrong. You will loose all of that encrypted data.

Really though in your case. You would need an Autoplay program to run after mounting the USB drive. There is plenty of info out there if you search for it. Technet.microsoft.com has a lot of good information.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
Guys so I guess my problem is too complicated because nobody really understood it :-]
Ghafoer86 if you please just look at the picture - that is exactly what I did (just not at the compatibility menu because it is not there)
Broe23 why would I put my BAT file into startup? The USB drive is not connected all the time, so I mount it whenever I connect it. What do you mean by mounting all the time and losing data? What is the problem with it? I am doing it like this for some years already with this truecrypt container... How else would I get into it?
Autorun.inf does not work for me, maybe autorun is disabled for USB drives or I wrote it wrong but it does not run that file
[autorun]
open=c4ebcnl.bat

BUT I found a solution which looks horrible and I would never found out by myself, but it works
pushd %~dp0 - this command changes the current dir and drive to where the BAT or CMD file is run from (I would really expect the shortcut properties to handle this, but it does not)
Windows batch file starting directory when 'run as admin' - Stack Overflow
 

My Computer

System One

  • OS
    Windows 8.1
You create the batch file to look to see if the USB drive is connected or not. It is a long forgotten art that most no longer know how to create these files.

Also if you have the OS set to not auto mount the removable media. Then it is pointless to even go through all of these troubles.

If you really want to do it correct. Look up how to create a PE disc.

As for changing the font in the Command Window. You just right click in the upper part of the window and choose to edit the properties. Also when you run Command Prompt as Admin. It will always default to System32.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
Well that is interesting. You did not answer any of my questions but np :) Can you point me to some article about this usb drive detection in bat/cmd? I actually coded this thing already in AutoIt. About autorun - I have freshly installed Win 8.1 and I did not change any settings regarding this, but now I checked it and it is set to "open folder to view files" and there seems to be no choice which would use autorun.inf. I guess it is a wise security measure in Win8.
But again I don't understand you - how is bootable PE disc related to this? :)
The font settings was somehow set finally, so it is readable again even when run as admin...
 

My Computer

System One

  • OS
    Windows 8.1
You need to look this information up yourself. Only way you are going to learn how to do this stuff. Is to research it. That is how the rest of us old timers learned how to write these scripts and batch files. We did not have the Internet or forums to ask questions. We had to physically pick up a book to find out how to create these programs.

As for the font settings for the Command Prompt. I stated how you can change that for the Command Prompt.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
LOL and I guess those old timers have a habit to never answer a question because these newbies are not worth it;) So thanks for your "help". For your information I also learned a lot from books, but nobody can read all the books and that is why we have forums and ways to share knowledge, got it?
 

My Computer

System One

  • OS
    Windows 8.1
Also I would really like to know how (the heck) do I change the font in this administrator cmd window permanently. I did runas cmd window and changed it there but it remains the same when starting this shortcut.

Change it in the shortcut.

sfc_dism_sfc.jpg
 

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
Yes, but just as a hobby.:geek:

They pay me in gummy bears.:drool:

No, seriously, did my suggestion help ?
 

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
You might be able to permanently assign a drive letter to your USB stick using Disk Management.

I have an external HDD that "always" uses the same drive letter (not the first available drive letter), if it is available.
It only uses a different letter, if I have plugged in multiple USB storage devices, prior to connecting that HDD.

Note:
I am using Windows 7, so it might not work in the W8 "collection".
 

My Computer

System One

  • OS
    Windows 7 Ultimate SP1 (64 bit), Linux Mint 18.3 MATE (64 bit)
    Computer type
    PC/Desktop
    System Manufacturer/Model
    n/a
    CPU
    AMD Phenom II x6 1055T, 2.8 GHz
    Motherboard
    ASRock 880GMH-LE/USB3
    Memory
    8GB DDR3 1333 G-Skill Ares F3-1333C9D-8GAO (4GB x 2)
    Graphics Card(s)
    ATI Radeon HD6450
    Sound Card
    Realtek?
    Monitor(s) Displays
    Samsung S23B350
    Screen Resolution
    1920x1080
    Hard Drives
    Western Digital 1.5 TB (SATA), Western Digital 2 TB (SATA), Western Digital 3 TB (SATA)
    Case
    Tower
    Mouse
    Wired Optical
    Other Info
    Linux Mint 16 MATE (64 bit) replaced with Linux Mint 17 MATE (64 bit) - 2014-05-17
    Linux Mint 14 MATE (64 bit) replaced with Linux Mint 16 MATE (64 bit) - 2013-11-13
    Ubuntu 10.04 (64 bit) replaced with Linux Mint 14 MATE (64 bit) - 2013-01-14
    RAM & Graphics Card Upgraded - 2013-01-13
    Monitor Upgraded - 2012-04-20
    System Upgraded - 2011-05-21, 2010-07-14
    HDD Upgraded - 2010-08-11, 2011-08-24,
It will work also with Windows 8.x.x lehnerus2000.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
David, I do not know where the OP got the whole IBM thing from. IBM did not invent Windows, nor Dos. We could of course get into a nice discussion about that and how the whole Batch file thing came from DRDos, MP/M & CP/M.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
Now to get back on subject. See the following for how to do what you are wanting to do. Launching a script when a specific USB device is connected - Support - AutoHotkey Community But the problem that you are going to run into is that since this volume is encrypted with Truecyrpt. You are going to run into some roadblocks.

Personally I would just create a C++ or C# app that you can just click on the app in Metro or the shortcut in the desktop to mount and ask for your password to allow access to the drive.

You never want to automount an encrypted drive without having some sort of fail safe to keep others from just accessing your computer and inserting the drive. Thus allowing the OS to automatically allow access to the files on it.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
David, I do not know where the OP got the whole IBM thing from. IBM did not invent Windows, nor Dos. We could of course get into a nice discussion about that and how the whole Batch file thing came from DRDos, MP/M & CP/M.

I didn't know how to take the remark.

Was it a compliment or a jab ?

I wish the OP would post a clarification.

Historical note: Gates & associates bought DOS for $50,000 & leased it to IBM.IBM thought the $$$ was in hardware.They were wrong. :)
 

My Computer

System One

  • OS
    Windows 8.1.1 Pro with Media Center
    Computer type
    PC/Desktop
    System Manufacturer/Model
    Gateway
    CPU
    AMD K140 Cores 2 Threads 2 Name AMD K140 Package Socket FT1 BGA Technology 40nm
    Motherboard
    Manufacturer Gateway Model SX2110G (P0)
    Memory
    Type DDR3 Size 8192 MBytes DRAM Frequency 532.3 MHz
    Graphics Card(s)
    ATI AMD Radeon HD 7310 Graphics
    Sound Card
    AMD High Definition Audio Device Realtek High Definition Audio USB Audio Device
    Monitor(s) Displays
    Name 1950W on AMD Radeon HD 7310 Graphics Current Resolution 1366x768 pixels Work Resolution 1366x76
    Screen Resolution
    Current Resolution 1366x768 pixels Work Resolution 1366x768 pixels
    Hard Drives
    AMD K140
    Cores 2
    Threads 2
    Name AMD K140
    Package Socket FT1 BGA
    Technology 40nm
    Specification AMD E1-1200 APU with Radeon HD Graphics
    Family F
    Extended Family 14
    Model 2
    Extended Model 2
    Stepping 0
    Revision ON-C0
    Instruction
    Browser
    Opera 24.0
    Antivirus
    Avast Internet Security
If you get a chance to watch it. Watch "Steve Jobs: The lost Interview". Also American Experience: Silicon Valley is a good one. That one is available at pbs.org. Now if you want a really good read. Read "What the Dormouse said." A lot of the younger generation does not realize how much of today's technology and software, along with forums like this. Is all due in part of those of us that have been around since the Home Brew Computer Club days.

The whole IBM money laundering scheme though is an interesting story in itself. Same with Xerox/Parc. In how much it has to do with what we have now. Along with how we interact with technology in itself.

Halt and Catch Fire, which is going to premiere on AMC 6/01. Is going to be interesting in seeing how they portray the PC revolution of the 80's.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
David I just confused the dism command in your picture with something used in IBM, so I am sorry, don't worry about it :-]
Broe you continue to surprise me with inconsistency of your thought process :D You said there is a way to monitor USB drives using BAT file (which I really doubt) but now you write about Autohotkey solution :) I said I coded the same thing in AutoIt - it is quite similar to AutoHotkey. But thanks for this, it is useful. And don't hesitate to share your oldtimer experience and insight. This is always appreciated ;)
Anyway my bat file does not mount the truecrypt volume without asking for anything - it displays a password prompt.
 

My Computer

System One

  • OS
    Windows 8.1
Yes there is a way to monitor the USB drives through a batch script. You though need to go out and do your own research on this. I have given you some free links. You just need to take the time to go out and read the information in them.

As for IBM and the Dism command. I see no connection between the two.
 

My Computer

System One

  • OS
    Linux Mint 17.2
    Computer type
    Laptop
    System Manufacturer/Model
    Toshiba Satellite C850D-st3nx1
    CPU
    AMD E1-1200 APU with Radeon (tm) HD Graphics 1.40 GHZ
    Memory
    12GB
    Graphics Card(s)
    AMD Radeon™ HD 7310 Graphics
    Sound Card
    Realtek HD
    Monitor(s) Displays
    LCD
    Screen Resolution
    1366 x 768
    Hard Drives
    Crucial M500 240GB SSD
    Mouse
    Logitech M525
    Internet Speed
    45/6 - ATT U-Verse
    Browser
    Google Chrome
    Antivirus
    None needed. It is Linux.
    Other Info
    Arris NVG589 Gateway; Router - Cisco RV320; Switch - Netgear GS108 8-Port Switch & Trendnet TEG-S50g 5-Port Switch; Access Points - Engenius ECB350, Trendnet TEW-638APB; NAS - Lenovo ix2-4; Printer - Brother HL-2280DW; Air Print Server - Lantronix XPrintServer

    A/V UPS - Tripp-Lite Smart 1500LCD 1500 Va/900 W.
well thanks for your inspiration, but I guess I will leave this challenge to some bolder ones to go for ;) As I said I have it coded in AutoIt already so I will rather go tackle some other funny computer issues which are taking my time recently - like synchronizing bookmarks over 4 different browsers and 4 different OSes using Xmarks :( I can tell you THAT is a challenge...
 

My Computer

System One

  • OS
    Windows 8.1
Back
Top